Back to demo index

gnuplot demo script: boxplot.dem

autogenerated by webify.pl on Fri Oct 28 21:17:06 2016
gnuplot version gnuplot 5.0 patchlevel 5
Your browser does not support the HTML 5 canvas element
          # unzoom rezoom zoom text ?
     
#
# Boxplot demo
#

print "*** Boxplot demo ***"

set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set boxwidth  0.5
set pointsize 0.5

unset key
set border 2
set xtics ("A" 1, "B" 2) scale 0.0
set xtics nomirror
set ytics nomirror
set yrange [0:100]

plot 'silver.dat' using (1):2, '' using (2):(5*$3)


Click here for minimal script to generate this plot


Your browser does not support the HTML 5 canvas element
          # unzoom rezoom zoom text ?
     

# Comparing sub-datasets

set xtics auto
set yrange [*:*]
set title "Distribution of energy usage of the continents, grouped by type of energy source\n"
set ylabel "Billion Tons of Oil Equivalent"

plot 'energy_circles.dat' using (1):($8/1.e6):(0):4


Click here for minimal script to generate this plot


Your browser does not support the HTML 5 canvas element
          # unzoom rezoom zoom text ?
     

# Sort factors alphabetically

set style boxplot sorted

replot


Click here for minimal script to generate this plot


Your browser does not support the HTML 5 canvas element
          # unzoom rezoom zoom text ?
     

# The same as above, with manual filtering
# Note that you have to specify the factors and you have to set the xtics as well.
# However, you have greater control over the appearance of the plot
# e.g. the order of the boxplots, their colors, the tic labels
# The previous form is intended for interactive usage while the latter form is better suited
# to creating publication-ready graphs.

factors = "Coal Gas Hydroelectric Nuclear Oil Renewable"
n_f = words(factors)
set xtic ("" 1)
set for [i=1:n_f] xtics add (word(factors,i) i) 

t(x) = x/1.e6
filter(col, factor_col, level) = (strcol(factor_col) eq word(factors, level)) ? t(column(col)) : 1/0

plot for [i=1:n_f] 'energy_circles.dat' using (i):(filter(8, 4, i)) 


Click here for minimal script to generate this plot