Every time I use gnuplot, I am amazed at how difficult it is to conjure up the simplest graphs, so when I finally get to the bottom of one, I’ll try to post the solution here as a reference for myself, and anyone else who might come looking.
If you’re new to gnuplot, you might want to get out now while you still can 😉
The box and whiskers plot
There are a few different styles of box and whiskers plots and this link gives a pretty good description.
The two gotchas for were what values you need and in what order. These scripts are set up to use the following columns, in order:
- X value (for ordering left-right across the graph)
- 1st Quartile
- 3rd Quartile
The other gotcha I had was wanting to have labels across the x-axis rather than numbers. To accomplish this, I added a 7th column with the label, then I used the following:
set xrange[0:3] set yrange[0:10] # Data columns: X Min 1stQuartile Median 3rdQuartile Max Titles set bars 4.0 set style fill empty plot 'data.csv' using 1:3:2:6:5:xticlabels(7) with candlesticks title 'Quartiles' whiskerbars, '' using 1:4:4:4:4 with candlesticks lt -1 notitle
The xticlabels(7) is the key to the x-axis labels, saying to use the values from column 7 for the labels.