13

I've been trying to figure out how to change the chart from scientific notation to just show the 5 digit numbers. I've tried scale and scale ticks with not success.

How can I change the y-axis and data values to show the decimals not in scientific notation?

\begin{tikzpicture}
\centering
\begin{axis}[
    width=300pt,
    height=250pt,
    axis lines*=left, % Don't display the top and right lines
    ybar, % Display it as a bargraph
    enlarge y limits={upper,value=0.2},
    legend style={at={(0.5,-0.20)}, % -.20 y-axis
    anchor=north,legend columns=-1},
    ylabel={Densities},
    nodes near coords,
    every node near coord/.append style={ anchor=mid west, rotate=90},
    symbolic x coords={Class1,Class3,Class5,Class7,Class9,Class11,Class13,Class15,Class17,Class19,Class21,Class23},
    xtick=data,
    xticklabel style={ inner sep=0pt, anchor=north east, rotate=70 },
    nodes near coords align={vertical},
]
\addplot coordinates { (Class1,0.0968) (Class3,0.0887) (Class5,0.1452) (Class7,0.0726)
    (Class9,0.0403) (Class11,0.0081) (Class13,0.0161) (Class15,0.0000)
    (Class17,0.0161) (Class19,0.0081) (Class21,0.0000) (Class23,0.0081) };
\end{axis}
\end{tikzpicture}
krizzo
  • 233

1 Answers1

17

You can use yticklabel style={/pgf/number format/fixed}:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\centering
\begin{axis}[
    width=300pt,
    height=250pt,
    axis lines*=left, % Don't display the top and right lines
    ybar, % Display it as a bargraph
    enlarge y limits={upper,value=0.2},
    legend style={at={(0.5,-0.20)}, % -.20 y-axis
    anchor=north,legend columns=-1},
    ylabel={Densities},
    nodes near coords,
    every node near coord/.append style={ anchor=mid west, rotate=90},
    symbolic x coords={Class1,Class3,Class5,Class7,Class9,Class11,Class13,Class15,Class17,Class19,Class21,Class23},
    xtick=data,
    xticklabel style={ inner sep=0pt, anchor=north east, rotate=70 },
    nodes near coords align={vertical},
  yticklabel style={/pgf/number format/fixed},
]
\addplot coordinates { (Class1,0.0968) (Class3,0.0887) (Class5,0.1452) (Class7,0.0726)
    (Class9,0.0403) (Class11,0.0081) (Class13,0.0161) (Class15,0.0000)
    (Class17,0.0161) (Class19,0.0081) (Class21,0.0000) (Class23,0.0081) };
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128