2

After answering a question in pgfplots, asking to plot a function; I thought about how I can map the 3D function into the planes. Something like the plots in this page but I could not reach any solution.

Here are my functions and their output. I want to show the left plot in the xy plane of the 3d plot; or map the function on xz and yz planes.

enter image description here

% pdflatex
\documentclass[margin=2mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
       \pgfmathdeclarefunction{F}{3}{\pgfmathparse{#1* exp(#2*#3)}}
\begin{axis}
        [
        smooth, grid=both,minor tick num=1,
        xlabel=$x$,ylabel=$y$,
        tick align=inside,
        samples=1000,
        samples y=0,
        ]

        \addplot [solid, thick, data cs=polarrad, domain=0:10*pi] {F(5,-0.1,x)};
\end{axis}
\end{tikzpicture}
~
\begin{tikzpicture}
       \pgfmathdeclarefunction{F}{3}{\pgfmathparse{#1* exp(#2*#3)}}
\begin{axis}
        [smooth, grid=both,minor tick num=1,
        xlabel=$x$,ylabel=$y$,zlabel=$z$,
        samples=1000,
        samples y=0,
        ]

        \addplot3+
        [solid, thick, black,
        mark=none,
        thick,
        domain=0:10*pi,
        ]
        ({F(5,-0.1,x)*cos(deg(x))},{F(5,-0.1,x)*sin(deg(x))},{F(5,-0.1,x)});
\end{axis}
\end{tikzpicture}
\end{document}
enthu
  • 3,795
  • 3
    \addplot3 [...] ({F(5,-0.1,x)*cos(deg(x))},{F(5,-0.1,x)*sin(deg(x))},{0}); will plot the function in the xy plane. Is that what you mean? – Jake Oct 27 '14 at 12:53
  • @Jake That is exactly what I want. I want to show the function in the xy, xz, yz and 3D plot in just one plot output. I mean, show those 2d functions in the walls of the 3d plot. – enthu Oct 27 '14 at 12:58
  • You can take a look at http://tex.stackexchange.com/a/31715/2552 for something similar. – Jake Oct 27 '14 at 13:45

1 Answers1

3

Thanks to Jake for his comment, I plotted what I wanted. The plot seems a liitle ugly because it is crowded with four plots; however it is really nice to show mapped functions besides to their 3d shape plot. Also, the important point in plotting such graph was that the user should take care at which coordinate the side walls of the 2d plot is located. At the bellow plot, at z=0, the xy plane exists; at y=4, the xz plane exists and at x=-4 the yz plane exists.

enter image description here

% pdflatex
\documentclass[margin=2mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}
       \pgfmathdeclarefunction{F}{3}{\pgfmathparse{#1* exp(#2*#3)}}
\begin{axis}
        [smooth, grid=both,minor tick num=1,
        xlabel=$x$,ylabel=$y$,zlabel=$z$,
        samples=1000,
        samples y=0,
        domain y=0:6
        ]

        \addplot3+
        [dashed, black,thick,
        mark=none,
        thick,
        domain=0:25*pi,
        ]
        ({F(5,-0.1,x)*cos(deg(x))},{F(5,-0.1,x)*sin(deg(x))},{F(5,-0.1,x)});

        \addplot3 [domain=0:25*pi,samples=500, samples y=0, black!50, smooth] ({F(5,-0.1,x)*cos(deg(x))},{F(5,-0.1,x)*sin(deg(x))},{0});
        \addplot3 [domain=0:25*pi,samples=500, samples y=0, red!50, smooth] ({F(5,-0.1,x)*cos(deg(x))},{4},{F(5,-0.1,x)});
        \addplot3 [domain=0:25*pi,samples=500, samples y=0, blue!50, smooth] ({-4},{F(5,-0.1,x)*sin(deg(x))},{F(5,-0.1,x)});
\end{axis}
\end{tikzpicture}
\end{document}
enthu
  • 3,795