16

When i use scale ticks in my plots i can't get those multiplicators to move anywhere. So basically i use plots like:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
 \begin{document}
  \begin{tikzpicture} 
    \begin{axis}[scaled ticks=true]
    \addplot coordinates { (20000,0.0005) (40000,0.0010) (60000,0.0020)}; 
    \end{axis}
  \end{tikzpicture}%
 \end{document}

which gives:

enter image description here

So my Question is: How can i get this x tick scale label to move onto the right side of the right y-axis? So that it is above the x-axis? (The mind behind this question is, that i sometimes have large x-labels, which then are very close to the scale label)

  • I have taken the liberty of downscaling the image (for this the key small is quite valuable) :) – zeroth Sep 12 '12 at 11:10
18

You should use the key: every x tick scale label which lets you overwrite the default placements. Notice that the keyword at within this style refers to the absolute size of the axis environment and are not in cm or pt.

So:

every x tick scale label/.style={
    at={(1,0)},xshift=1pt,anchor=south west,inner sep=0pt
}

will make the x tick scale be at the graph south east corner, shifted 1 pt to the right and anchored at south west (making sure that it is not overlapping with the graph).

Inserting this in your code yields:

enter image description here

You can always play with the yshift etc. as well.

For reference, the default option for x-tick scale placement is:

every x tick scale label/.style={at={(xticklabel cs:0.9,5pt)},yshift=-2em,left,inner sep=0pt}

where you should notice that the xticklabel cs is the coordinate system in the x-axis. Thus you can use this to manually place it according to the x-tick labels. Try for instance:

every x tick scale label/.style={at={(xticklabel cs:1)},anchor=south west}
  • Great! Maybe one additional Question: where did you find it? Since i wasn't able to locate it in the manual. – bloodworks Sep 12 '12 at 11:23
  • 2
    It is in the manual, however, it is difficult to find unless you know the name of the keys... :) – zeroth Sep 12 '12 at 11:24
  • @zeroth I tried to use this code to change the position of a the right axis tick scale label of a two y axes plot but it made no change. Is it possible to use it with two ordinates plots? – perr0 Jan 20 '13 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.