2

Problem:

It's the times ten to the 3 bit part which bothers me. Not just that is exists but also because it's positioned itself in a strange place.

My files is formatted so it is in MHz so I don't want it saying 10^-3 at all. (read the texdoc to siunitx and found some nice stuff but nothing obvious to help with this.

I also want to be able to have some more ticks for in between values. I also want it scaled so above the y=0 line and below it have equal sizing.

I would also like to put extra ticks.

![axis2][2]

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{tikz}
\usepackage{siunitx}
\pgfplotsset{compat=1.5.1}

\begin{document}


\begin{tikzpicture}
\begin{axis}[    yticklabel={\pgfmathparse{(\tick)}\num[round-mode=places, round-precision=1]{\pgfmathresult}}, xlabel={Resonant Magnetic Field [mT]}, ylabel={Residuals [MHz]}]
\addplot[mark size=0.5, only marks,
      error bars/.cd,
        y dir=both, y explicit,
      ]
   table [y error index=2]
   {residuals_glycerin.txt};
   \addplot[mark size = 0.5, only marks,color=black]
    table [x index = 0, y index= 1]
    {residuals_glycerin.txt}; 
    \draw[ultra thin,gray] (axis cs:\pgfkeysvalueof{/pgfplots/xmin},0) -- (axis cs:\pgfkeysvalueof{/pgfplots/xmax},0); 

\end{axis}
\end{tikzpicture}


\end{document}

Contents of file

328.43799 -0.00106 0.00092
328.18900 -0.00038 0.00092
327.92099 0.00113 0.00092
327.70099 0.00057 0.00092
327.43600 0.00194 0.00092
327.19101 0.00246 0.00092
327.10599 -0.00389 0.00092
326.54800 0.00005 0.00092
326.82001 -0.00162 0.00092
326.54999 -0.00003 0.00092
326.30301 0.00057 0.00092
326.07700 0.00027 0.00092

Output:

plot

  • Add scaled y ticks=false to your axis options (and increase the round-precision in your yticklabel to 3). – Jake Mar 12 '13 at 11:01
  • @jake no this is in MHz so it can't be helped by this suggestion because it would still have the 10^-3 which is not correct, – Magpie Mar 12 '13 at 11:02
  • No, if you add scaled y ticks=false, the 10^-3 is removed and the ticks have values of 0.004, 0.002 and so on. – Jake Mar 12 '13 at 11:03
  • @jake yeah sorry I thought I'd tried that permutation but I had a look now and it did work. Sorry! – Magpie Mar 12 '13 at 11:04

Browse other questions tagged or ask your own question.