viridis
我正在尝试通过诸如或 之类的颜色图为路径着色,从而使我的 3D 图着色jet
。
我没有在我的代码中看到这个问题:
梅威瑟:
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\begin{document}
\pgfplotsset{colormap name=viridis}
\begin{tikzpicture}
\begin{axis}[%
minor tick num = 1,
width=0.5\textwidth,
height=0.58\textwidth,
view={20}{20},
no markers,
line width=1pt,
colormap/viridis
]
\addplot3+[mesh/ordering=colwise, shader=interp] table[x=X,y=Y,z=Z,col sep=comma] {M_vec_t_konst_B_3D.csv};
\end{axis}
\end{tikzpicture}
\end{document}
文件内容的一部分如下所示:
\begin{filecontents}{\M_vec_t_konst_B_3D.csv}
t,X,Y,Z
1,-.00497500009974665,.00049916489126945,.999987500047175
2,-.00980050543315321,.00198665703923687,.999950000556712
3,-.0143295126224099,.00443263370356666,.999887502818356
4,-.0184199947073833,.00778784045780322,.999800007717161
5,-.0219372868785203,.0119843856077163,.999687517759949
6,-.0247563606311884,.0169367224299857,.999550035813364
7,-.0267640258546666,.0225430120448395,.999387564968603
8,-.0278608499582266,.0286865788699628,.99920010991405
9,-.0279630289409471,.0352378122081474,.998987674519678
10,-.0270038810677119,.042056007814212,.998750264889457
11,-.0249352365935453,.0489916957762689,.998487886120038
12,-.0217284515057763,.0558887888591327,.998200545575422
13,-.0173752135951718,.0625871942592308,.997888249688422
14,-.0118880219680633,.0689251584129809,.997551006987507
15,-.00530035196029782,.0747420217620526,.997188825287703
16,.00233342919743369,.0798806274188361,.99680171416455
17,.0109385639175199,.0841900702264634,.996389682926374
18,.0204205496072064,.0875280343292949,.995952742128616
19,.030666298224561,.0897633835859951,.99549090245734
20,.0415453168338121,.0907783059402484,.995004175465682
\end{filecontents}
答案1
只需将您的情节重写为
\addplot3+[mesh] table[x=X,y=Y,z=Z,col sep=comma] {M_vec_t_konst_B_3D.csv};
它应该可以工作。
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{compat=1.18}
\begin{document}
\pgfplotsset{colormap name=viridis}
\begin{tikzpicture}
\begin{axis}[%
minor tick num = 1,
width=0.5\textwidth,
height=0.58\textwidth,
view={20}{20},
no markers,
line width=1pt,
colormap/viridis]
\addplot3+[mesh, shader=interp]
table[x=X,y=Y,z=Z,col sep=comma]
{M_vec_t_konst_B_3D.csv};
\end{axis}
\end{tikzpicture}
\end{document}