我想将 xlabel 拆分成行。我的 MWE 如下:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
% xlabel = Temp, $N$ \newline Slice at X
xlabel = Temp $N$ \newline Slice at X
, ylabel = $P$
, zlabel = Response
, xmin = -1
, xmax = 1
, ymin = -1
, ymax = 1
%, x dir = reverse
, view={-40}{30}]
\addplot3
[
surf
, faceted color=blue
, samples = 15
, domain = -1:1
, y domain = -1:1
]
{56+ 1* x + 2* y + 3*x*y};
\end{axis}
\end{tikzpicture}
\end{document}
我想知道如何将 xlabel 拆分为两行以及如何在 xlabel 中放置逗号 (,)。谢谢
答案1
xlabel
打印为节点。因此,您可以设置特定的文本宽度。这允许换行。可以通过选项进行修改xlabel style
。第 173 页的文档中显示了一个示例:
xlabel style={align=right,text width=3cm}
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
% xlabel = Temp, $N$ \newline Slice at X
xlabel style={draw,rectangle,align=left,text width=2cm},
xlabel = Temp $N$ \newline Slice at X
, ylabel = $P$
, zlabel = Response
, xmin = -1
, xmax = 1
, ymin = -1
, ymax = 1
%, x dir = reverse
, view={-40}{30}]
\addplot3
[
surf
, faceted color=blue
, samples = 15
, domain = -1:1
, y domain = -1:1
]
{56+ 1* x + 2* y + 3*x*y};
\end{axis}
\end{tikzpicture}
\end{document}