I want to produce a comparison graph chart like this: enter image description here

I have found information about bar graphs, but not about line comparison graphs as I am trying to do. Any help?. Thanks.


1 Answer 1


Such plots are called comb plots and they are described in detail in section 4.5.7 Comb Plots of the pgfplots manual (v 1.16). Since I do not have your data, I copied the example from there, and modified the coordinates of the second plot slightly, and also introduced a nontrivial dash pattern.

    \addplot+ [line width=1pt,
    ] coordinates {
        (0,3) (1,2) (2,4) (3,1) (4,2)
    \addplot+ [line width=1pt,dash pattern=on 4pt off 1pt on 2pt off 1pt,
    ] coordinates {
        (0,3.4) (1,1.8) (2,4.2) (3,1.2) (4,1.6)

enter image description here

  • Thank you so much. I could find such plots in the section 4.4.6 of the Manual: tools.ietf.org/doc/texlive-doc/latex/pgfplots/pgfplots.pdf
    – Alfredo
    Dec 26, 2018 at 17:35
  • @Alfredo Yes, because you're looking at the 2011 version of the manual. My statement refers to the current version (1.16), and I should probably mentioned this explicitly.
    – user121799
    Dec 26, 2018 at 17:37

You must log in to answer this question.

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