我想通过使用以下方法来获取右侧显示的结果(编译以下 MWE)title style
:
\documentclass{standalone}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{calc,decorations,patterns,shapes.arrows}
\usepackage{mathtools}
\usepackage{tikzscale}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots,colormaps}pictures
\begin{document}
\begin{tikzpicture}
\begin{axis}[title=(a),
title style={at={(0,1)},
anchor=north west,
draw=black,fill=white}]
\addplot[blue] {x};
\end{axis}
\begin{axis}[xshift=10cm]
\node[draw=black,fill=white,anchor=north west] at (rel axis cs:0,1) {$(a)$};
\addplot[red] {x};
\end{axis}
\end{tikzpicture}
\end{document}
一个相关的(如果不是相同!)回答的问题是这个并建议使用title style={at={(0.1,0.8)}}
。我想改用 之类的东西title style={at={(0,1)},anchor=north west}
,但正如您所见,结果并不完全是我想要的。谢谢
答案1
问题是,而默认标题样式中有title style
。使用而不是,这将完全重新定义样式。every axis title/.append style
yshift=6pt
every axis title/.style={..}
title style={..}
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[title=(a),every axis title/.style={below right,at={(0,1)},draw=black,fill=white}]
\addplot[blue] {x};
\end{axis}
\begin{axis}[xshift=10cm]
\node[draw=black,fill=white,anchor=north west] at (rel axis cs:0,1) {(a)};
\addplot[red] {x};
\end{axis}
\end{tikzpicture}
\end{document}