6

I am using the following code in the preamble to set the position of my axis labels:

\pgfplotsset{
    every axis y label/.style={at={(-0.1,0.5)},rotate=90}
}

I have roughly 10 plots, where this settings is correct and what I actually want. But for a single other plot I would like to set the position differently. Is is possible to set a specific option to ignore the global setting and define a local exception? Something like:

\begin{tikzpicture}
\begin{axis}[%
overwrite axis y label/.style={at={(-0.2,0.5)},rotate=90}
\end{axis}
\addplot[...]
\end{tikzpicture}%
1
  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – jub0bs
    Mar 10, 2014 at 9:29

2 Answers 2

6

Just use every axis y label/.style for that axis.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{
    every axis y label/.style={at={(-0.1,0.5)},rotate=90},
    width=6cm
}
\setlength\parindent{0pt}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ylabel=thing]
\addplot {x^2};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[%
ylabel=thing,
every axis y label/.style={at={(-0.2,0.5)},rotate=90}]
\addplot {x^2};
\end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{axis}[ylabel=thing]
\addplot {x^2};
\end{axis}
\end{tikzpicture}%

\end{document}
3

In my documents, I usually have the following in the preamble:

\pgfplotsset{every axis/.append style={
  line width=.6pt,
  tick style={line width=0.6pt,black},
  grid style={line width=0.6pt,dotted,gray}}}

If I now just write

\begin{axis}[%
grid style={line width=6pt,dotted,gray},...]

within a figure this will overwrite the predefined setting.

2
  • any idea how to override a "no marks" style?
    – Ben Voigt
    Dec 7, 2014 at 23:03
  • Nevermind, "only marks" seems to re-enable marks.
    – Ben Voigt
    Dec 7, 2014 at 23:12

You must log in to answer this question.

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