7

I currently use this code to create a plot:

\begin{tikzpicture}
    \begin{axis}
        \addplot[ycomb,mark=*] coordinates  {(0, 13) (1, 12) (2, 11) (3, 13) (4, 13) (5, 13) (6, 12) (7, 12) (8, 12) (9, 14)};
    \end{axis}
\end{tikzpicture}

It looks like this:

While this kind of representation is great for showing the difference between the individual data points, this is entirely irrelevant for what I want to show. The point of this plot is to show that the data points are close together. I want the y axis to start at zero. How can this be done?

1 Answer 1

10

Use ymin = 0 as an option to the axis

\documentclass[border = 5pt]{standalone}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
  \begin{axis}[ymin=0]
    \addplot[ycomb,mark=*] coordinates  {(0, 13) (1, 12) (2, 11) (3, 13) (4, 13) (5, 13) (6, 12) (7, 12) (8, 12) (9, 14)};
  \end{axis}
\end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .