# How to enforce printing the decimal part in pgfmath macros?

I have the opposite problem to this question. I want the decimal parts of an integer printed for consistency's sake. I already tried specifying the precision but without success. See below.

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ybar,
nodes near coords, %={\pgfmathprintnumber[fixed,precision=2]{\pgfplotspointmeta}}
]
\addplot coordinates { (1,1.11) (2,2.22)(3,3.00)(4,4.44) };
\end{axis}
\end{tikzpicture}
\end{document}


Is it possible to let this specifications only affect the nodes over the bars and let the axis ticks stay without additional decimal parts? That would be the high point.

\pgfkeys{
/pgf/number format/precision=0,
/pgf/number format/fixed zerofill=true }


to 0 and using

nodes near coords={\pgfmathprintnumber[fixed,precision=2]{\pgfplotspointmeta}}


in the axis-specifications, I get "normal " integers on the axes and enforced decimal parts in the chart itself.

-
Your title asks about pgfmath, but your example is using pgfplots, which is not the same. Please change the title accordantly if this question is directly targeted on pgfplots, not pgfmath macros in general. – Martin Scharrer Feb 2 '12 at 16:28
@MartinScharrer: Of course I will change the title if it's flawed. Truth be told, my knowledge of pgfplots and pgfmath is basic at best. I encountered this problem by using pgfplots and deducted from posts such as the linked one that there must be something as pgfmath at work here. So if someone knows what the better title would be, please tell me and I'll change it accordingly. – meep.meep Feb 3 '12 at 9:23

You need:

/pgf/number format/precision=1,
/pgf/number format/fixed zerofill=true


\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\pgfkeys{
/pgf/number format/precision=1,
/pgf/number format/fixed zerofill=true
}

\begin{axis}[ybar, nodes near coords]
\addplot coordinates { (1,1.11) (2,2.22)(3,3.00)(4,4.44) };
\end{axis}
\end{tikzpicture}
\end{document}

-
Thanks a lot so far. Would you happen to know the solution to my follow up question as well? – meep.meep Feb 3 '12 at 9:33
Never mind that, I already solved the follow up. Thanks again! – meep.meep Feb 3 '12 at 9:53