Search code examples
gnuplotbar-chart

data boxes not displayed by gnuplot


I'd like to do a bar chart using gnuplot.

I used this settings

set style data boxes
set style fill solid  
plot 'foo.dat' using 1:2:(1) linewidth 2

with the content of foo.dat being

8 1
10 1
11 4
12 4

gnuplot only displays the bars corresponding to the last two lines.

Why ? Is there an other solution than adding "9 0" into my data file ?

Thank you in advance


Solution

  • Your y-axis is probably autoscaled to [1:4]. Use e.g.

    set yrange [0:*]
    

    Then the axis always starts at 0 but is autoscaled at the other end.