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.

How can I offset my ylabel so it doesn't smudge with the numbers?

enter image description here

code

\begin{figure}[H]
\centering 
\begin{tikzpicture}
\begin{axis}[
    scale=1.8,
    xmin=-15,xmax=15,xlabel={Current $mA$}, ylabel={Residuals $mV$}
]
\addplot [only marks, black, error bars/.cd, y dir=both, x dir=both, y explicit, x explicit, error bar style={color=mapped color}]
      table[x=Residuals,y=Voltage,x error=xerr,y error=yerr]{sfnErr.dat}; % plot the data
\draw[ultra thin,gray] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0); 

\end{axis}
\end{tikzpicture}

\caption{*}
\end{figure}
share|improve this question
    
Use some thing like: \pgfplotsset{every axis y label/.append style={xshift=1.5em} } Adjust the distance as suitable. –  Harish Kumar Jan 31 '13 at 0:56
    
Where to put it? In the preamble? –  Magpie Jan 31 '13 at 1:00
    
If you want it for all graphs, put it in the preamble. If only for one graph, put it as an option to your \begin{axis}[every axis y label/.append style={xshift=1.5em}] –  Harish Kumar Jan 31 '13 at 1:04
    
It would be easier to help if you provide an MWE and your or a portion of your sfnErr.dat. –  hpesoj626 Jan 31 '13 at 1:16
1  
@jake yes I agree. Too many people edit questions and forget about the title. It's why I can never find things. I will make this a new question. –  Magpie Mar 12 '13 at 10:49
show 2 more comments

1 Answer

up vote 4 down vote accepted

If you insert \pgfplotsset{compat=1.7} (or whatever your PGFPlots version number is, as long as it's newer than 1.3) into your preamble, the axis labels will be placed dynamically, taking into account the width of the tick labels.

share|improve this answer
    
How do you check what version you have? –  Magpie Mar 9 '13 at 22:16
    
It's listed in the .log file that is generated when you compile your document. –  Jake Mar 9 '13 at 22:21
    
Thanks for your help @jake I have added some other stuff to elaborate on some additional axis formatting problems. I can verify that your solution did work on my question before I edited. If mods want me to accept this and start a new questin with additional queries I am happy to do so though. –  Magpie Mar 12 '13 at 10:17
add comment

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.