我想画一个没有填充的三角形面片。
最小工作示例:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\node at (axis cs:0,0) {$1$};
\addplot[patch,patch type=triangle,fill=none] coordinates {(0,0) [] (-1/sqrt(3),-1) (1/sqrt(3),-1)};
\node at (axis cs:{-1/sqrt(3)},-1) {$x$};
\node at (axis cs:{1/sqrt(3)},-1) {$y$};
\end{axis}
\end{tikzpicture}
\end{document}
不起作用,补丁仍然有颜色。如何禁用补丁的填充?
答案1
您可以将关键字添加mesh
到选项中\addplot
以禁用填充。
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\node at (axis cs:0,0) {$1$};
\addplot[patch, mesh, patch type=triangle] coordinates {(0,0) [] (-1/sqrt(3),-1) (1/sqrt(3),-1)};
\node at (axis cs:{-1/sqrt(3)},-1) {$x$};
\node at (axis cs:{1/sqrt(3)},-1) {$y$};
\end{axis}
\end{tikzpicture}
\end{document}