3

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}
Magpie
  • 2,294
  • Use some thing like: \pgfplotsset{every axis y label/.append style={xshift=1.5em} } Adjust the distance as suitable. –  Jan 31 '13 at 00:56
  • Where to put it? In the preamble? – Magpie Jan 31 '13 at 01: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}] –  Jan 31 '13 at 01: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 01:16
  • Do you want to get rid of the scaling of the tick labels (so you'd have 0.002 instead of 2.0 * 10^(-3))? Then see How do you remove the axis multiplier?. Or do you want to transform your ticks to kHz? Then see pgfplots exponent in ylabel instead of yticklabel – Jake Mar 12 '13 at 10:21
  • In general, it's best to have only one issue per question, and to make some effort to make it more generally applicable. Instead of a title like "How can I fix the formatting of my axis", which doesn't really say much about the actual problem and thus is unlikely to help others with similar issues, break it down to something like "How do I remove the axis multiplier"/"How can I adjust the position of the xlabel"/"How can I increase the number of ticks" and make small compilable example documents. – Jake Mar 12 '13 at 10:24
  • 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

1 Answers1

4

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.

Jake
  • 232,450
  • How do you check what version you have? – Magpie Mar 09 '13 at 22:16
  • It's listed in the .log file that is generated when you compile your document. – Jake Mar 09 '13 at 22:21
  • 1
    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