I need decimal values (they are in the code but in the plot. they are getting as integers) for the values above the bars. Also, the x-axis legend is overlapping so I need it in 2 lines. I mean each x legend in two lines. For example, for "total time", time should come in next line
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepackage{pgfplotstable}
\renewcommand*{\familydefault}{\sfdefault}
\usepackage{sfmath}
\begin{document}
\begin{tikzpicture}
\centering
\begin{axis}[
ybar, axis on top,
title={cb},
height=8cm, width=15.5cm,
bar width=0.35cm,
ymajorgrids, tick align=inside,
major grid style={draw=white},
enlarge y limits={value=.1,upper},
ymin=0, ymax=30,
axis x line*=bottom,
axis y line*=right,
y axis line style={opacity=0},
tickwidth=0pt,
enlarge x limits=true,
legend style={
at={(0.5,0.6)},
anchor=north,
legend columns=-1,
/tikz/every even column/.append style={column sep=0.5cm}
},
ylabel={Computational time ($\mu$ s )},
symbolic x coords={
ramesh india, ramu england, rama america, raman poland, ram ukrain, ramani nedherlands, total time},
xtick=data,
nodes near coords={
\pgfmathprintnumber[precision=0]{\pgfplotspointmeta}
}
]
\addplot [draw=none, fill=blue!30] coordinates {
(ramesh india,8)
(ramu england, 1)
(rama america,5.5)
(raman poland,0)
(ram ukrain,0)
(ramani nedherlands,2)
(total time,16.5) };
\addplot [draw=none,fill=red!30] coordinates {
(ramesh india,8)
(ramu england, 1)
(rama america,5)
(raman poland,7.5)
(ram ukrain,3)
(ramani nedherlands,2)
(total time,25.5) };
\addplot [draw=none, fill=brown!30] coordinates {
(ramesh india,8)
(ramu england, 1)
(rama america,5)
(raman poland,7.5)
(ram ukrain,3)
(ramani nedherlands,2)
(total time,28.5) };
\legend{C, M, P}
\end{axis}
\end{tikzpicture}
\end{document}
pgfplots
to use integers there withprecision=0
...precision=
says how many decimals to add, so start by trying to change that value.