UNTITLED MEMORANDUM

あまり知られていないこと

【TikZ】回転体の図

以下の記事で作成した図のメモです.

TikZ, pgfplotで作成しました.

f:id:IsThisAPen:20170205160703p:plain

  \begin{tikzpicture}
    \begin{axis}[
        title={Rotation of $f(x)$},
        colormap/greenyellow,
        view={30}{30},%15,30
        axis lines=center,
        ticks=none,
        xmin=0, xmax=2.5, ymin=-40, ymax=60, zmin=-40, zmax=40,
        xlabel=$x$, ylabel=$y$, zlabel=$z$,
        every axis x label/.style={
          at={(ticklabel* cs:1.05)},
          anchor=west,
        },
        every axis y label/.style={
          at={(ticklabel* cs:1.05)},
          anchor=west,
        },
        every axis z label/.style={
          at={(ticklabel* cs:1.05)},
          anchor=south,
        }
      ] 
      \addplot3[
        %            mesh,
        surf,
        opacity=0.5,
        shader=faceted,
        samples=20,
        domain=0:2,y domain=0:2*pi,
        z buffer=sort]
      (x,{(60/(x+2))* cos(deg(y))}, {(60/(x+2)) * sin(deg(y))});
      \draw[-stealth,red,thin] (axis cs:0,0,0) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))});
      \addplot3[
        red,
        samples=2,
        domain=0:2,y domain=0:pi/4,
        z buffer=sort]
      (0,{10* cos(deg(y))}, {10* sin(deg(y))});
      \node at(axis cs:0,5,8) [anchor=west]{$\theta$};
      \draw[-stealth,red,thin] (axis cs:0,0,0) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))});
      \draw[dashed,thin] (axis cs:0,{30*cos(deg(pi/4))},0) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))});
      \draw[dashed,thin] (axis cs:0,0,{30*sin(deg(pi/4))}) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))});
    \end{axis}
  \end{tikzpicture}