【发布时间】:2021-02-26 18:44:43
【问题描述】:
这个问题与我的相似,但与 Latex 无关:Legend outside the plot
我使用 tikzpicture 和包 pgfplots 在 Latex 中制作了一个线图。不幸的是,可以看出,图例挡住了视线。
我可以把它移开吗?向右说,走出剧情区域?
谢谢
【问题讨论】:
-
见this question。 PS:别忘了给 MWE 提供更多帮助。
这个问题与我的相似,但与 Latex 无关:Legend outside the plot
我使用 tikzpicture 和包 pgfplots 在 Latex 中制作了一个线图。不幸的是,可以看出,图例挡住了视线。
我可以把它移开吗?向右说,走出剧情区域?
谢谢
【问题讨论】:
线
every axis legend/.append style={ at={(0.05,0.95)}, anchor=north west,legend columns = 1
在 pgfplotset{} 中应该这样做!
anchor 告诉图例它想给哪个角坐标,“append style ={ at = {(x,y)} }”中的坐标告诉你想要它去的那个角。
我通常只是摆弄数字,直到我喜欢我所看到的,但你可以使用一般规则,即 0 和 1 之间在情节内部,超过 1 在情节外部。因此,例如,如果您希望它位于当前位置的右侧,但在绘图之外,您可以使用:
\begin{tikzpicture}
\pgfplotsset{
every axis legend/.append style={ at={(1.05,0.95)}, anchor=north west,legend columns = 1}}
\begin{axis}
... rest of plotting ...
\end{axis}
\end{tikzpicture}
【讨论】: