8

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}
Moriambar
  • 11,466
Causality
  • 649
  • 5
  • 16

1 Answers1

13

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

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128