此代码
\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(1)=(blue!80!black!90) color(2)=(blue!80!black!70) color(3)=(blue!80!black!50) color(4)=(blue!80!black!30)},
xmin=0,xmax=1,ymin=0,ymax=1,zmin=0,zmax=1, grid=major]
\addplot3[%xmin=0,xmax=1,
opacity=0,
fill opacity=1,
table/row sep=\\,
patch,
patch type=polygon,
vertex count=3,
patch table with point meta={%
% pt1 pt2 pt3 cdata
7 3 5 2.82843 \\
2 3 6 2.12132 \\
3 7 6 2.12132 \\
3 1 5 2.82843 \\
2 0 3 1. \\
0 1 3 1. \\
1 0 5 2. \\
4 0 6 3. \\
0 2 6 3. \\
0 4 5 2. \\
4 6 5 1. \\
6 7 5 1. \\
}
]
table {
x y z \\
0 0 0 \\
0 0 0.873387 \\
0 0.873387 0 \\
0 0.873387 0.873387 \\
0.623336 0 0 \\
0.623336 0 0.250051 \\
0.623336 0.250051 0 \\
0.623336 0.250051 0.250051 \\
};
\end{axis}
\end{tikzpicture}
\end{document}
绘制以下 3D 图形:
图中显示了多边形右侧和上方的分界线,以及图形正面的分界线。
有什么方法可以删除这些线吗?
问候
答案1
我必须承认我不明白为什么,但faceted color=none
似乎可以解决问题。我本来以为我需要将此颜色设置为 之一fill
。
\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(1)=(blue!80!black!90) color(2)=(blue!80!black!70) color(3)=(blue!80!black!50) color(4)=(blue!80!black!30)},
xmin=0,xmax=1,ymin=0,ymax=1,zmin=0,zmax=1, grid=major]
\addplot3[%xmin=0,xmax=1,
faceted color=none,
line width=0pt,
fill opacity=1,
table/row sep=\\,
patch,
patch type=polygon,
vertex count=3,
patch table with point meta={%
% pt1 pt2 pt3 cdata
7 3 5 2.82843 \\
2 3 6 2.12132 \\
3 7 6 2.12132 \\
3 1 5 2.82843 \\
2 0 3 1. \\
0 1 3 1. \\
1 0 5 2. \\
4 0 6 3. \\
0 2 6 3. \\
0 4 5 2. \\
4 6 5 1. \\
6 7 5 1. \\
}
]
table {
x y z \\
0 0 0 \\
0 0 0.873387 \\
0 0.873387 0 \\
0 0.873387 0.873387 \\
0.623336 0 0 \\
0.623336 0 0.250051 \\
0.623336 0.250051 0 \\
0.623336 0.250051 0.250051 \\
};
\end{axis}
\end{tikzpicture}
\end{document}