我想要一个越线在里面xlabel
和ylabel
.不知何故位置的选项 xlabel style
并且ylabel style
有一个作用于这结果,这是预期的行为吗?
\documentclass[tikz,border=1mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
ylabel style = {align = left},
xlabel style = {align = right},
xlabel = {aaa\\ bbb},
ylabel = {aaa\\ bbb},
axis lines = center,
xmin = -80,
xmax = 60,
ymin = -15,
ymax = 15,
enlarge x limits = 0.05,
enlarge y limits = 0.05,
% ylabel style = {align = left},
% xlabel style = {align = right},
% xlabel = {aaa\\ bbb},
% ylabel = {aaa\\ bbb},
]
\addplot[
color = blue,
mark = *,
line width = 1pt,
] coordinates {
(-30,-10)
(-20,-10)
(-10,0)
(0,0)
(10,0)
(20,10)
(30,10)
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
% ylabel style = {align = left},
% xlabel style = {align = right},
% xlabel = {aaa\\ bbb},
% ylabel = {aaa\\ bbb},
axis lines = center,
xmin = -80,
xmax = 60,
ymin = -15,
ymax = 15,
enlarge x limits = 0.05,
enlarge y limits = 0.05,
ylabel style = {align = left},
xlabel style = {align = right},
xlabel = {aaa\\ bbb},
ylabel = {aaa\\ bbb},
]
\addplot[
color = blue,
mark = *,
line width = 1pt,
] coordinates {
(-30,-10)
(-20,-10)
(-10,0)
(0,0)
(10,0)
(20,10)
(30,10)
};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
问题出在键[xy]label style
和的顺序上axis lines
。
这些键中的每一个都会修改相应的every axis [xyz] label
风格,但与[xyz]label style
键不同的是附加(/.append style
)风格,axis lines
然后axis [xyz] line
直接按键放(/.style
)风格从而使累积的风格值丢失。
我认为这是一个pgfplots
错误/缺陷,除非该行为有明确记录。我已经报告了https://github.com/pgf-tikz/pgfplots/issues/404(是的,问题编号为 404,而不是 404 页面)。