막대 그래프 라텍스

막대 그래프 라텍스

이 코드가 왜 처음 2개의 막대만 제공하고 3개 막대는 모두 제공하지 않는지 이해할 수 없습니다. 나머지 형식은 완벽하지만 불완전할 뿐입니다.

무엇을 바꿔야 합니까?

\begin{figure}
    \centering
\begin{tikzpicture}
\begin{axis}[
    xlabel=Utterance Type,
    ylabel=Frequency,
    symbolic x coords={Question, Statement, Uncertain},
    xtick = data
    enlargelimits=1,
    ybar interval=0.4,
    ]
\addplot coordinates {(Question,4073) (Statement,8541) (Uncertain,2044)};
\end{axis}
\end{tikzpicture}\caption{Overall Responses by Utterance Type}\label{Overall}
\end{figure}

답변1

아마도 다음은 달성하려는 목표에 더 가깝습니다.

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{figure}
    \centering
\begin{tikzpicture}
\begin{axis}[
    xlabel=Utterance Type,
    ylabel=Frequency,
    symbolic x coords={Question, Statement, Uncertain},
    xtick = data,
    ybar,
    bar width=20pt,
    ]
\addplot coordinates {(Question,4073) (Statement,8541) (Uncertain,2044)};
\end{axis}
\end{tikzpicture}\caption{Overall Responses by Utterance Type}\label{Overall}
\end{figure}

\end{document}

관련 정보