When using tikzpicture
in the pgfplots
package, how can I change use PERCENTAGE for xticklabel or yticklabel.
Here is a simple example:
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=Cost,
ylabel=Rate]
\addplot[color=red,mark=x] coordinates {
(2,0.003)
(3,0.004)
(4,0.005)
};
\end{axis}
\end{tikzpicture}
\end{document}
How can I change the yticklabel to percentage style: i.e. 0.3%, 0.4%, 0.5%, etc.
I checked the documentation pdfplots.pdf
and pdfplotstable.pdf
. There are many Number Printing Settings available but I couldn't find anything that can covert the numbers to percentage style.
Thanks to all for your help! This is what I have right now. It still has problems.
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=Cost,
ylabel=Rate,
scaled ticks=false,
yticklabel=\pgfmathprintnumber{\tick}\,\%,
yticklabel style={/pgf/number format/.cd,fixed,precision=3}]
\addplot[color=red,mark=x] coordinates {
(2,0.003)
(3,0.004)
(4,0.005)
};
\end{axis}
\end{tikzpicture}
\end{document}