및 을 Bessel
사용하여 3D 기능을 그리고 있습니다 . 내가 하려는 것은 3D 함수의 투영인 3D 상자 위에 플롯을 그리는 것입니다.pgfplots
gnuplot
플롯 을 사용하려고 생각했지만 contour gnuplot
높은 number
윤곽선을 사용하더라도 다음 이미지에서 볼 수 있듯이 투영의 전체 표면을 채울 수 없습니다.
간격을 피하고 투영을 원활하게 채우는 방법에 대한 아이디어가 있습니까?
이미지는 다음 코드를 사용하여 만들어졌습니다.
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [width=\textwidth,
height=\textwidth,
ultra thick,
colorbar,
colorbar style={yticklabel style={text width=2.5em,
align=right,
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1,
},
},
xlabel={$\rho_x=k_xr_x$},
ylabel={$\rho_y=k_yr_y$},
zlabel={$j_l(\rho)$},
3d box,
zmax=2.5,
xmin=-3, xmax=3,
ymin=-3.1, ymax=3.1,
ytick={-3, -2, ..., 3},
grid=major,
grid style={line width=.1pt, draw=gray!30, dashed},
x tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
y tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
z tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
]
\addplot3[surf,
shader=interp,
mesh/ordering=y varies,
domain=-3:3,
y domain=-3.1:3.1,
]
gnuplot {besj0(x**2+y**2)};
\addplot3[contour gnuplot={output point meta=rawz,
number=1000,
labels=false,},
z filter/.code={\def\pgfmathresult{2.5}},
domain=-3:3,
y domain=-3:3]
gnuplot {besj0(x**2+y**2)};
\end{axis}
\end{tikzpicture}
\end{document}
답변1
등고선 플롯 대신 원래 플롯의 포인트 메타를 사용하여 상수를 플롯합니다.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [width=\textwidth,
height=\textwidth,
ultra thick,
colorbar,
colorbar style={yticklabel style={text width=2.5em,
align=right,
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1,
},
},
xlabel={$\rho_x=k_xr_x$},
ylabel={$\rho_y=k_yr_y$},
zlabel={$j_l(\rho)$},
3d box,
zmax=2.5,
xmin=-3, xmax=3,
ymin=-3.1, ymax=3.1,
ytick={-3, -2, ..., 3},
grid=major,
grid style={line width=.1pt, draw=gray!30, dashed},
x tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
y tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
z tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
]
\addplot3[surf, samples=51,
shader=interp,
mesh/ordering=y varies,
domain=-3:3,
y domain=-3.1:3.1,
]
gnuplot {besj0(x**2+y**2)};
\addplot3[surf, samples=51,
shader=interp,
mesh/ordering=y varies,
domain=-3:3,
y domain=-3.1:3.1,
point meta=rawz,
z filter/.code={\def\pgfmathresult{2.5}},
]
gnuplot {besj0(x**2+y**2)};
\end{axis}
\end{tikzpicture}
\end{document}
극좌표를 사용하면 IMHO 결과가 더욱 매력적입니다.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis} [width=\textwidth,
height=\textwidth,
ultra thick,
colorbar,
colorbar style={yticklabel style={text width=2.5em,
align=right,
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1,
},
},
xlabel={$\rho_x=k_xr_x$},
ylabel={$\rho_y=k_yr_y$},
zlabel={$j_l(\rho)$},
3d box,
zmax=2.5,
xmin=-3, xmax=3,
ymin=-3.1, ymax=3.1,
ytick={-3, -2, ..., 3},
grid=major,
grid style={line width=.1pt, draw=gray!30, dashed},
x tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
y tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
z tick label style={/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1
},
data cs=polar,
]
\addplot3[surf, samples=51,
shader=interp,
z buffer=sort,
%mesh/ordering=y varies,
domain=0:360,
y domain=3.1:0,
]
gnuplot {besj0(y**2)};
\addplot3[surf, samples=51,
shader=interp,
%mesh/ordering=y varies,
domain=0:360,
y domain=0:3.1,
point meta=rawz,
z filter/.code={\def\pgfmathresult{2.5}},
]
gnuplot {besj0(y**2)};
\end{axis}
\end{tikzpicture}
\end{document}