[haskell-gnuplot] histogram

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 1 10:58:44 BST 2011


Michael Litchard schrieb:
> Thank you for this request. It made me think about how I was going
> about this project. My approach was to go from what I conceived to be
> a simpler model, and then go to a more realistic data set later. In
> attempting to write a gnuplot script I realized that the sketch I sent
> you didn't really help at all. So, I've sent you what I think is a
> minimal but realistic sample dataset, with a gnuplot script. I took
> the script from the gnuplot tutorial. I tried to remove as much as I
> could that I didn't think was important.
> 
> set terminal png transparent nocrop enhanced font arial 8 size 820,820
> set output 'histograms.2.png'
> set boxwidth 0.9 absolute
> set style fill   solid 1.00 border -1
> set style histogram clustered gap 1 title  offset character 0, 0, 0
> set style data histograms
> set xtics   ("220" 0.00000, "320" 1.00000, "420" 2.00000, "520"
> 3.00000, "620" 4.00000, "720" 5.00000)
> set title "Comparison of how well software revisions perform on each
> hardware version"
> set yrange [ 0.00000 : 3000. ] noreverse nowriteback
> plot 'example.dat' using 2:xtic(1) ti col, '' u 3 ti col, '' u 4 ti
> col, '' u 5 ti col
> 
> 
> Firmware_Version 1.0011 1.0012 1.0013 1.0014
> 220               102 152 172 192
> 320               213 233 263 293
> 420               378 388 408 458
> 520               408 433 463 483
> 620               840 850 860 890
> 720               920 1200 1500 2000

Thank you for that example! It helps me a lot to recognize, what we are
talking about. What makes me uncomfortable is, that gnuplot wants the
'xtics' as a list argument to 'set xtics'. For this particular example
it would make more sense to me to have a data file like

Firmware_Version x 1.0011 1.0012 1.0013 1.0014
220              0  102 152 172 192
320              1  213 233 263 293
420              2  378 388 408 458
520              3  408 433 463 483
620              4  840 850 860 890
720              5  920 1200 1500 2000

where the 'x' column is used for the xtics. This would also warrant that
the number of xtics matches the number of rows in the data file. Maybe
there are different types of histograms where this does not work.

I have to think about this issue. Maybe I add special histogram
functions, that generate the plot command together with 'set xtics' in
order to assert consistency.



More information about the Gnuplot mailing list