I am trying to make a 3D plot with TikZ, as shown in the picture, but I was not able to do it.

enter image description here

I have an example of my Latex code





\begin{axis} [ticklabel style = {font = \scriptsize},grid]
\addplot3 [%
samples y=0, line width=1pt]


If anyone has an idea and solutions on how to draw the required diagram, I would be very grateful.

1 Answer 1


This could be a starting point. It uses 3d and perspective TikZ libraries, and I'm 'reconstructin your function (hope is the right one).


\begin{tikzpicture}[3d view={120}{30},domain=-1:3.5,samples=1001]
\draw[canvas is xz plane at y=-1] (-2,-2) rectangle (2,2);
\draw[canvas is yz plane at x=-2] (-1,-2) rectangle (3.5,2);
\draw[canvas is xy plane at z=-2] (-2,-1) rectangle (2,3.5);
\draw[blue] plot ({exp(-2*(\x-1.25)*(\x-1.25))*cos((\x-1.25)*1140)},\x,{exp(-2*(\x-1.25)*(\x-1.25))*sin((\x-1.25)*1140)});
\draw[red]  plot ({exp(-2*(\x-1.25)*(\x-1.25))*cos((\x-1.25)*1140)},\x,-2);
\draw       plot (-2,\x,{exp(-2*(\x-1.25)*(\x-1.25))*sin((\x-1.25)*1140)});

enter image description here

Update: another version using a \pic for the function and its projections.


   pics/spiral/.style 2 args={code=%
      \draw[pic actions] plot[domain=#1:#2,samples=1001]

\begin{tikzpicture}[3d view={120}{30},line cap=round,line join=round]
\draw[canvas is xy plane at z=-2] (-2,-3) rectangle (2,3);
\draw[canvas is xz plane at y=-3] (-2,-2) rectangle (2,2);
\draw[canvas is yz plane at x=-2] (-3,-2) rectangle (3,2);
  \pic[teal,y=0] {spiral={-3}{3}};
\pic [red           ,canvas is xy plane at z=-2] {spiral={-3}{3}};
\pic [green!50!black,canvas is zy plane at x=-2] {spiral={-3}{3}};
\pic [blue,thick]                                {spiral={-3}{3}};

enter image description here

  • 1
    Finally, I get to ask you this question: do you know of any projection computing ability in TikZ? I mean, you had to draw red and black via a function (const, x,y) and (z,const, y). is there a package/library that can compute the projection of blue function on the XY plane? I am aware that this is a big stretch and there are many tools that are better fit for the task.
    – anis
    May 30 at 14:18
  • 1
    @anis, not exactly, but your comment gave me an idea using scopes and 3d library. See my edit May 30 at 19:18
  • 1
    that's actually what I thought of. hats off
    – anis
    May 30 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .