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 have this plots here.

It is generated by the pgfplots code at the bottom. For the y tick labels, instead of the one shown in the figure, I would like to have {2, 4, 6, 8, 10} by the y ticks, and a $10^{-2}$ on top of y axis, just like Jake's solution to this question, which produces a figure with the desired y tick label format. (However, this does not do so for my ytick={0.02, 0.04, 0.06, 0.08, 0.1}) here

\documentclass{article}
\usepackage{pgfplots}    

\begin{document}

\begin{tikzpicture}[scale=0.9]
\begin{axis}[
minor tick num=1,
xmin=0,
xmax=6,
ymin=0,
ytick={0.02, 0.04, 0.06, 0.08, 0.1},
xlabel={X}, ylabel={Y},
yticklabel=\pgfmathprintnumber{\tick}]
\addplot [black,thick] table [row sep=crcr]{
0 0\\
2 0.15\\
};
\end{axis}
\end{tikzpicture}

\end{document}
share|improve this question

1 Answer 1

up vote 9 down vote accepted

You can use the scaled y ticks=base 10:2 option:

\documentclass{article}
\usepackage{pgfplots}    

\begin{document}

\begin{tikzpicture}[scale=0.9]
\begin{axis}[
minor tick num=1,
xmin=0,
xmax=6,
ymin=0,
ytick={0.02, 0.04, 0.06, 0.08, 0.1},
xlabel={X}, ylabel={Y},
yticklabel=\pgfmathprintnumber{\tick},
scaled y ticks=base 10:2
]
\addplot [black,thick] table [row sep=crcr]{
0 0\\
2 0.15\\
};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
scaled y ticks=base 10:2 is exactly what I was looking for. Thanks for the quick response. –  Causality Jul 23 '12 at 22:56

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.