Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.