I have some temperature data in a text file, and I would like to represent it in a ‘boxed’ plot, showing the temperature of each day like an histogram.
23 10 2012 12.3
28 10 2012 14.1
30 11 2012 30.4
...
I’m triying to represent it with a simiple gnuplot script like this:
set terminal png enhanced font font_file size size_x, size_y tiny
set xdata time
set timefmt "%d %m %Y"
set format x "%d"
set boxwidth 0.9 relative
plot u 1:4 w boxes
I would like to leave blank the days where no data is available, but gnuplot gives these days the value of the last day a data was available. For example, in the data file I wrote before, gnuplot would give a 12.3 to the 23th of october, but I would like leave this gap without any bar.
Is there a way to get this? I have discarted an histogram representation because I’ve read that it is not compatible with time data.
Thank you in advance
Your problem is the line
set boxwidth 0.9 relative. Relative says that you’re trying to fill 90% of the space between adjacent boxes. You probably want to set an absolute boxwidth. If you change your script toset boxwidth 0.9 absolute, then you’ll see vertical lines. This is because when using time data, the x-axis unit is actually seconds, so your box is only ~1 second wide when your x-scale is multiple days. So, to get each box to be the width of a single day you would useHere’s the complete script:
and the output: