# Logarithmic bar plot

I'm currently trying to create a diagram, with a logarithmic scale on y axis. This mostly works, except that the value of nodes near coords is wrong. Without ymode=log it shows e.g. 20551 as label. With ymode=log it shows 9.93. Is it possible to get behaviour of linear mode? (So it displays again 20551 instead of 9.93)

And is it possible to get legend automatically centered?

\begin{tikzpicture}
\begin{axis}[
width=0.8\textwidth,
ybar,
enlargelimits=0.15,
ylabel={\#Pathes},
ymode=log,
log ticks with fixed point,
xlabel={Test},
symbolic x coords={1 - 10, 11 - 100, 101 - 1000, 1001 - 10000, >10000},
xtick=data,
nodes near coords={\pgfmathprintnumber{\pgfplotspointmeta}},
nodes near coords align={vertical},
legend style={at={(0,-2.5em)}, draw=none, anchor=north, legend columns=-1, legend     style={/tikz/every even column/.append style={column sep=0.5cm}}}
]
\addplot coordinates {(1 - 10, 20551) (11 - 100, 19784) (101 - 1000, 2436) (1001 - 10000, 149) (>10000, 12)};
\addplot coordinates {(1 - 10,4) (11 - 100,4) (101 - 1000,4) (1001 - 10000, 0) (>10000, 0)};
\legend{used,understood,not understood}
\end{axis}
\end{tikzpicture}


Current output: Wanted output: • Welcome to TeX.SX! Please help us to help you by completing your code to create a minimal working example (MWE) as that makes it much easier to understand your question and reproduce the problem. – cfr Dec 16 '14 at 0:39
• @SunBlack: You can center the legend using at={(current axis.south)}, below=6ex. Sorry for missing that part of the question (the duplicate I linked to only covers the logarithm part). In general, it's best to only have a single question per post. – Jake Dec 16 '14 at 10:40
• The question has been reopened. The part about the labels in logarithmic plots has been answered in nodes near coords with logarithmic axis: Wrong values. Could you edit your question to remove that part and focus on the legend positioning? – Jake Dec 16 '14 at 12:14

You can center legend placing it at position 0.5 (without units) which represents the the mid point of each axis. You can also the legend anchor.

\documentclass[tikz,border=2mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=0.8\textwidth,
ybar,
enlargelimits=0.15,
ylabel={\#Pathes},
ymode=log,
log ticks with fixed point,
xlabel={Test},
symbolic x coords={1 - 10, 11 - 100, 101 - 1000, 1001 - 10000, >10000},
xtick=data,
nodes near coords={\pgfmathprintnumber{\pgfplotspointmeta}},
nodes near coords align={vertical},
legend style={at={(0.5,-2.75em)},anchor=north, draw=none, anchor=north, legend columns=-1, legend  style={/tikz/every even column/.append style={column sep=0.5cm}}}
]
\addplot coordinates {(1 - 10, 20551) (11 - 100, 19784) (101 - 1000, 2436) (1001 - 10000, 149) (>10000, 12)};
\addplot coordinates {(1 - 10,4) (11 - 100,4) (101 - 1000,4) (1001 - 10000, 0) (>10000, 0)};
\legend{used,understood,not understood}
\end{axis}
\end{tikzpicture}
\end{document} 