pgfplots:选项顺序影响“xlabel 样式”(换行符)

pgfplots:选项顺序影响“xlabel 样式”(换行符)

我想要一个越线在里面xlabelylabel.不知何故位置选项 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 页面)。

相关内容