# Problem in modifying contour label style in pgfplots

I am trying to modify the contour label style in a TikZ picture. I would like to have the label values in the format 0.0 instead of being integers. The following code produces a picture in which labels are shown as integers with no decimal point.

\documentclass[crop=true, border=0mm]{standalone}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
axis on top,
title = {$\omega_\phi\left(x, \sigma\right) = \frac{\Gamma}{\pi{R_c}^2}\exp\left[-\frac{\left(x-x_0\right)^2+\left(\sigma-R_0\right)^2}{{R_c}^2}\right]$},
xmin=2, xmax=3,
ymin=2, ymax=3,
view={0}{90},
xlabel = {$x$},
ylabel = {$\sigma$},
]
contour gnuplot = {contour label style={nodes={text=black}}},
samples=10,
contour/draw color={black},
]
{1/3.1415927/0.25^2*exp(-((x-2.5)^2+(y-2.5)^2)/0.25^2)};
\end{axis}
\end{tikzpicture}

\end{document}


The following picture is the result of the above code with 2000 samples.

How can I use the following code to adjust the label value format? For some reasons LaTeX complains about unknown key.

contour label style={
/pgf/number format/fixed,
/pgf/number format/precision=1,
}

-
Have you seen the example in the pgfplots manual on page 118? Does this not work? contour gnuplot = {contour label style={nodes={text=black},/pgf/number format/fixed,/pgf/number format/precision=1,}}, should to the trick. –  Qrrbrbirlbel Mar 3 '13 at 22:35
It works for the example in the manual. I used the following code contour gnuplot = {contour label style={ nodes={text=black}, /pgf/number format/fixed, /pgf/number format/precision=1,}}, but still the numbers are in integer. I also increased the precision but no change. –  A2009 Mar 3 '13 at 22:42
Ah, samples=10 will create a plot where the numbers are smaller than 1 so they are actually 0.1, 0.2 and so on. If you want to have decimals even though the value is an integer, you can use /pgf/number format/fixed zerofill (boolean key, accepts values true (default) and false). –  Qrrbrbirlbel Mar 3 '13 at 22:48
Thanks it worked. I used: contour gnuplot = {contour label style={ nodes={text=black}, /pgf/number format/fixed, /pgf/number format/fixed zerofill=true, /pgf/number format/precision=1,}}, –  A2009 Mar 3 '13 at 22:57
Could you check your previous question. Even your output shows the contour label as 0.1, 0.2, 0.3 and 0.4. If a higher value is used for samples the graph plotted is a) different (see also this question’s picture) and b) the numbers are integer. I’m confused. Let me post an answer (which I can delete if it does not work for your setup) and please check your PG/TikZ version by issuing \pgfversion in the document. The current version is 2.10. –  Qrrbrbirlbel Mar 3 '13 at 23:05

## Code

\documentclass[crop=true, border=0mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis on top,
title = {$\omega_\phi\left(x, \sigma\right) = \frac{\Gamma}{\pi{R_c}^2}\exp\left[-\frac{\left(x-x_0\right)^2+\left(\sigma-R_0\right)^2}{{R_c}^2}\right]$},
xmin=2, xmax=3,
ymin=2, ymax=3,
view={0}{90},
xlabel = {$x$},
ylabel = {$\sigma$},
]
contour gnuplot={
contour label style={
nodes={text=black},
/pgf/number format/fixed,
/pgf/number format/fixed zerofill,
/pgf/number format/precision=1,
}
},
samples=50,
contour/draw color={black},
]
{1/3.1415927/0.25^2*exp(-((x-2.5)^2+(y-2.5)^2)/0.25^2)};
\end{axis}
\end{tikzpicture}
\end{document}


-