我有这个数字:
\begin{tikzpicture}[scale=1]
\begin{axis}[xmin=0,xmax=1,ymin=0,ymax=1,enlargelimits=false,xlabel=$a_1$,ylabel=$a_2$]
\addplot [blue!80!black,fill=blue,fill opacity=0.4]
coordinates
{(0., 0.) (0., 0.2629952) (0., 0.43830780032) (0.1096032496,
0.43830780032) (0.6572250048, 0.26310039808) (0.657488, 0.)}
|- (axis cs:0,0) -- cycle;
\end{axis}
\end{tikzpicture}
我想对这个 3D 图形使用不同的等级(自定义色彩图):
\begin{tikzpicture}
\begin{axis}[view/v=25,view/h=110,xlabel=$a_1$,ylabel=$a_2$,zlabel=$a_3$,
colormap/greenyellow,
xmin=0,xmax=1,ymin=0,ymax=1,zmin=0,zmax=1, grid=major]
\addplot3[%xmin=0,xmax=1,
opacity=0,
fill opacity=0.6,
table/row sep=\\,
patch,
patch type=polygon,
vertex count=3,
patch table with point meta={%
% pt1 pt2 pt3 pt4 pt5 cdata
0 1 2 1. \\
2 3 0 3. \\
0 3 4 2. \\
3 2 4 2.12132 \\
2 1 4 3.53553 \\
1 0 4 2. \\
}
]
table {
x y z\\
0 0 0 \\
0 0 0.657488 \\
0 0.657488 0 \\
0.657488 0 0 \\
0.657488 0 0.657488 \\
};
\end{axis}
\end{tikzpicture}
根据第一个图颜色的等级:blue!80!black
。例如,如何创建从blue!20!black
到的颜色图blue!80!black
,例如 8 或 9 个级别?
问候
答案1
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view/v=25,view/h=110,xlabel=$a_1$,ylabel=$a_2$,zlabel=$a_3$,
colormap={darkblue}{color=(blue!20!black) color=(blue!80!black)},
xmin=0,xmax=1,ymin=0,ymax=1,zmin=0,zmax=1, grid=major]
\addplot3[%xmin=0,xmax=1,
opacity=0,
fill opacity=0.6,
table/row sep=\\,
patch,
patch type=polygon,
vertex count=3,
patch table with point meta={%
% pt1 pt2 pt3 pt4 pt5 cdata
0 1 2 1. \\
2 3 0 3. \\
0 3 4 2. \\
3 2 4 2.12132 \\
2 1 4 3.53553 \\
1 0 4 2. \\
}
]
table {
x y z\\
0 0 0 \\
0 0 0.657488 \\
0 0.657488 0 \\
0.657488 0 0 \\
0.657488 0 0.657488 \\
};
\end{axis}
\end{tikzpicture}
\end{document}