6

Only the third label appears for this bar chart. If I put only one data row, the label shows up fine. If I put two data rows, both the labels are hidden. If I put three data rows (as below), only the third label shows up.

Any ideas why this might be happening?

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\pgfplotstableread{
X   question                                                                interactionhigh InteractionLow  VisualHigh  VisualLow
1   {*I needed to learn a lot of material before I could get started with SIDNIE.}      6.50                6.18                6.22            5.96
2   {I felt very confident working with SIDNIE.}                                    5.60                5.55                6.11            6.04
3   {*I found the system very cumbersome for use.}                          6.50                6.64                6.44            5.62
}\datatable

  \begin{axis}[xbar=0,
   yticklabels from table={\datatable}{question},
   y tick label style={text width=5cm, align=right},
height=18cm,
width=10cm,
inner sep=0mm,
xmin=0,
xmax=7,
  ]

\addplot table[y=X,x={interactionhigh}] {\datatable};
\addplot table[y=X,x={InteractionLow}] {\datatable};
\addplot table[y=X,x={VisualHigh}] {\datatable};
\addplot table[y=X,x={VisualLow}] {\datatable};
\end{axis}
\end{tikzpicture}

\end{document}
5

You need to either explicitly specify which ticks to use (by saying ytick={1,...,3}), or specify to only label coordinates with data, by saying ytick=data:

\documentclass{article}
\usepackage{pgfplots}


\begin{document}

\begin{tikzpicture}
\pgfplotstableread{
X   question                                                                interactionhigh InteractionLow  VisualHigh  VisualLow
1   {*I needed to learn a lot of material before I could get started with SIDNIE.}      6.50                6.18                6.22            5.96
2   {I felt very confident working with SIDNIE.}                                    5.60                5.55                6.11            6.04
3   {*I found the system very cumbersome for use.}                          6.50                6.64                6.44            5.62
}\datatable

  \begin{axis}[xbar=0,
   yticklabels from table={\datatable}{question},
   y tick label style={text width=5cm, align=right},
y=2cm, enlarge y limits={abs=0.5},
width=10cm,
xmin=0,
xmax=7,
ytick=data,
  ]

\addplot table[y=X,x={interactionhigh}] {\datatable};
\addplot table[y=X,x={InteractionLow}] {\datatable};
\addplot table[y=X,x={VisualHigh}] {\datatable};
\addplot table[y=X,x={VisualLow}] {\datatable};
\end{axis}
\end{tikzpicture}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.