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 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}%
share|improve this question
    
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. –  Jubobs Mar 10 at 9:29

2 Answers 2

up vote 4 down vote accepted

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}
share|improve this answer

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.

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.