PGFPlotsで3D図を作図する
optionsのymode,xmodeにnormal(default)を設定すると普通のplot、logを入れると対数目盛になる いくつかaliasがある
<coordinate system>
axis
なんか他にもあるっぽいな
legendの位置などを指定する座標とか
\usepgfplotslibrary{<library>}=\usetikzlibrary{pgfplots.<library>}
code:vector.tikz(tex)
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{axis}[
title={3D Rotation},
view={:azimuth}{:elevation}
:azimuth:z軸回転量
:elevation:x軸回転量
0でx-z平面表示になる
おそらくyが紙面手前向き
90でx-y平面表示
単位は度数
axisという新しい<coordinate system>が定義される
code:vector.tikz(tex)
view={60}{30},
axis lines=none,
ticks=none,
xmin=-30, xmax=50, ymin=0-30, ymax=50, zmin=0, zmax=50,
]
%
%
\node at(axis cs:0,0,{50/2}) anchor=east{$(\boldsymbol{r}\cdot\boldsymbol{n})\boldsymbol{n}$}; %
\draw-stealth,thick (axis cs:0,0,0) -- (axis cs:{30/2},{30*sqrt(3)/2},50); \node at(axis cs:{30/2},{30*sqrt(3)/2},50) anchor=west{$\boldsymbol{r^\prime}$}; %
\drawthin,gray (axis cs:0,0,50) circle (300); %
%
\draw-stealth,dashed (axis cs:0,0,50) -- (axis cs:{30/2},{30*sqrt(3)/2},50); \draw thin,->(axis cs:10,0,50) arc (0:60:100); \end{axis}
\end{tikzpicture}
\end{document}
改変:
\begin{center}を削除
code:rotate-object.tikz(tex)
\usepackage{pgfplots}
\pgfplotsset{compat/show suggested version=false}
\begin{document}
\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))}); \drawdashed,thin (axis cs:0,{30*cos(deg(pi/4))},0) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))}); \drawdashed,thin (axis cs:0,0,{30*sin(deg(pi/4))}) -- (axis cs:0,{30*cos(deg(pi/4))},{30*sin(deg(pi/4))}); %
\filldraworange, opacity=0.5, domain=0:2, samples=200plot(axis cs:\x,{(60/(\x+2))},0) -- (axis cs:2,15,0) -- (axis cs:2,0,0)-- (axis cs:0,0,0) --(axis cs:0,30,0); \end{axis}
\end{tikzpicture}
\end{document}
結構メモリ食うみたいtakker.icon