我希望标签箭头看起来像使用时那样axis lines=center
,但我还希望 x 和 y 标签位于绘图外部,而不是实际绘图区域内。我已经浏览那本厚厚的手册一段时间了,但没有任何进展。我该如何实现这一点?
\documentclass{memoir}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ymin=0,ymax=1,xmin=0,xmax=1,
xlabel=$\mathit{foo}$,
ylabel=$\mathit{bar}$,
axis lines=center
]
\addplot[color=black, fill=black, fill opacity=0.5] coordinates {
(0.0,0.0)
(0.05, 0.3)
(0.1,0.5)
(0.2,0.7)
(0.3,0.8)
(0.4,0.9)
(0.5,0.92)
(0.6,0.93)
(0.7,0.95)
(0.8,0.99)
(1.0,1.0)
(1.0,0.0)};
\end{axis}
\end{tikzpicture}
\end{document}
我想要这样的标签:
但是轴是这样的:
答案1
为此,您应该使用axis lines=left
而不是axis lines=center
:
\documentclass{memoir}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ymin=0,ymax=1,xmin=0,xmax=1,
xlabel=$\mathit{foo}$,
ylabel=$\mathit{bar}$,
axis lines=center
]
\addplot[color=black, fill=black, fill opacity=0.5] coordinates {
(0.0,0.0)
(0.05, 0.3)
(0.1,0.5)
(0.2,0.7)
(0.3,0.8)
(0.4,0.9)
(0.5,0.92)
(0.6,0.93)
(0.7,0.95)
(0.8,0.99)
(1.0,1.0)
(1.0,0.0)};
\end{axis}
\end{tikzpicture}
\end{document}