Warm tip: This article is reproduced from stackoverflow.com, please click
bar-chart gnuplot

data boxes not displayed by gnuplot

发布于 2020-05-03 09:24:47

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

Questioner
Alan Leblanc
Viewed
61
Christoph 2020-02-15 04:22

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.