Example: Heart in 3D

Published 2014-03-15 | Author: cmhughes

An application of volumes of revolution for plotting a three-dimensional heart. If your TeX installation would throw an error "TeX capacity exceeded", you could use LuaLaTeX instead of pdfLaTeX, since it automatically allocates more memory.

This code was written by cmhughes on TeX.SE.

Download as: [PDF] [TEX]  •  [Open in writeLaTeX]

Heart in 3D

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.10}
\pgfplotsset{
  /pgfplots/colormap={pink}{%
    color(0cm) = (purple);
    color(1cm) = (pink!80!purple);
    color(2cm) = (pink!90);
    color(3cm) = (pink) }
}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[
      view={0}{10},
      axis equal,
      axis lines=none,
      colormap name =pink, 
    ]
    \addplot3[
      surf,
      shader=faceted,
      samples=50,
      domain=0:2*pi,y domain=0:2*pi,
      z buffer=sort,
      opacity=0.15
    ]
    (
      {(sin(deg(x)))^3*cos(deg(y))},
      {(sin(deg(x)))^3*sin(deg(y))},
      {(13*cos(deg(x))-5*cos(2*deg(x))-2*cos(3*deg(x))-cos(4*deg(x)))/16}
    );
  \end{axis}
\end{tikzpicture}
\end{document}

Comments

  • #1 all powers universal, December 15, 2014 at 6:02 p.m.

    I enjoy reading an article that will make people think. Also, thank you for allowing for me to comment!

Post a comment

Markdown syntax enabled. No HTML allowed.