1

I'm just starting to mess with pgfplots and just had a quick question in formatting bar charts. Specifically, I was trying to add labels to each of my y ticks and i couldn't figure it out.

\begin{tikzpicture}
\begin{axis}[
   title={How Well Do You Relate to Your Online Persona?
   every axis plot post/.style={/pgf/number format/fixed},
   ybar=5pt,
   bar width=80pt,
   x=3cm,
   ymin=0,
   axis on top,
   ymax=6,
   xtick=data,
   enlarge x limits=0.2,
   symbolic x coords={Person1,Person2},
]
\addplot coordinates {(Person1,5) (Person2,2)};
\end{axis}
\end{tikzpicture}
jub0bs
  • 58,916
theStig
  • 113

1 Answers1

1

To place your ticks on the y-axis in custom intervals, you just need to use the ytick = {<ticks>} directive, as described in section 4.14.1 of the pgfplots manual.

I also adapted Jubobs comment to place "speaking" labels for the yticks.

Here is a MWE, illustrating this

\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    title={How Well Do You Relate to Your Online Persona?},
    every axis plot post/.style={/pgf/number format/fixed},
    ybar=5pt,
    bar width=80pt,
    x=3cm,
    ymin=0,
    axis on top,
    ymax=6,
    xtick=data,
    ytick={0,...,6},
    yticklabels={Not at all, a bit, so so, quite well, well enough, very well},
    enlarge x limits=0.2,
    symbolic x coords={Person1,Person2},
]
\addplot coordinates {(Person1,5) (Person2,2)};
\end{axis}
\end{tikzpicture}
\end{document}

plot

Henri Menke
  • 109,596