In the examples they use a fixed number to set each boxplot:
plot 'data.txt' using (0):1 with boxplot
plots the data in the first column placed at the x-value 0
. For two plots it is accordingly:
set style data boxplot
plot 'data.txt' using (0):1, '' using (1):2
Gnuplot cannot determine automatically the number of columns, but you can achieve some kind of automatization as follows:
file = 'data.txt'
header = system('head -1 '.file);
N = words(header)
set xtics ('' 1)
set for [i=1:N] xtics add (word(header, i) i)
set style data boxplot
unset key
plot for [i=1:N] file using (i):i
If I duplicate the two columns you showed, and label them with A B C D
, I get the following plot with gnuplot 4.6.3:
As you see, outliers aren't taken into account. To hide the outliers, use set style boxplot nooutliers
.