0

I have a problem with my histogram. My y-axis is not in format I want. I want y-min = 0 and y-max = 12000 but my graphic is expressed in a power element.

Here's the code:

\documentclass[A4,11pt,twoside]{book}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{makeidx}
\usepackage{graphicx,subfig}
\usepackage{array, booktabs}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[ybar,ymin=0.0,ymax=12000.0, 
             height=8cm,
             ymajorgrids=true,
             ylabel={Risposte},
             symbolic x coords={
               $18-30$, $31-40$, $41-50$, $50-100$},
             xtick=data, nodes near coords,
             xlabel={Anni},
             nodes near coords align={vertical},
             xtick pos=left]
\addplot [fill=blue,draw=black, ball color=blue] coordinates{
   ($18-30$,1411)($31-40$,2486) ($41-50$,4258) ($50-100$,10841)};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

thanksenter image description here

Stevia
  • 47
  • Have you tried to add as options scaled y ticks = false and y tick label style={/pgf/number format/fixed}. Specifically the second part should solve your problem. – aps Sep 14 '16 at 07:11

1 Answers1

1

I think this question is already answered Here but since I still cannot comment, I'll answer it. As stated in the PGFplots Manual using the axis Option scaled y ticks = false solves this issue. Here is a MWE:

\documentclass[a4paper,11pt,twoside]{book}
\usepackage{pgfplots}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[ybar, ymin=0.0, ymax=12000.0, ymajorgrids=true, ylabel={Risposte},
     scaled y ticks = false,
     xtick=data, xlabel={Anni}, xtick pos=left,
         symbolic x coords={ $18-30$, $31-40$, $41-50$, $50-100$}, 
         nodes near coords, nodes near coords align={vertical}, height=8cm]
\addplot [fill=blue,draw=black, ball color=blue] coordinates{ ($18-30$,1411)($31-40$,2486) ($41-50$,4258) ($50-100$,10841)};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}