7

I have a few PGF plots in my document where the label positions need to be adjusted separately from other plots. I use the \pgfplotsset in preamble to adjust some general settings applicable to all the plots. An MWE is as follows:

\documentclass[]{article}

    \usepackage{tikz}
    \usepackage{pgf,pgfplots}
    \pgfplotsset{compat=newest}
    \pgfplotsset{plot coordinates/math parser=false}
    \pgfplotsset{
    label style={anchor=near ticklabel},
    xlabel style={yshift=0.5em},
    ylabel style={yshift=-0.5em},
    tick label style={font=\scriptsize },
    label style={font=\scriptsize},
    legend style={font=\scriptsize},
    title style={font=\fontsize{7}}}

\begin{document}


\begin{tikzpicture}
    \begin{axis}[%
        xlabel={XLABEL},
        ylabel={YLABEL},
        axis lines*=left,
        ylabel absolute, ylabel style={yshift=-1em}]
        \addplot+[mark=none] plot {x^2};
    \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
    \begin{axis}[%
        xlabel={XLABEL},
        ylabel={YLABEL},
        axis lines*=left]
        \addplot+[mark=none] plot {x^2};
    \end{axis}
\end{tikzpicture}


\end{document}

The problem I have is that when I want to adjust the label position in a plot axis property the labels font sizes get reset to the original value and are not \scriptsize

How can I set the individual label distance while preserving the global label style like fonts, etc. ? I know I can separately adjust the font size in the axis property but I would like to use a global setting for the fonts!

screenshot

0

1 Answer 1

9

As given in the manual

/pgfplots/ylabel absolute/.style={%
    /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90},
    /pgfplots/every y tick scale label/.style={
    at={(0,1)},above right,inner sep=0pt,yshift=0.3em
    },
}

is not an /.append style but overwrites the previous settings. Either you rename this style and change /.style keys to /.append style or add those settings manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .