Ferramentas de Utilizador

Ferramentas de Site


tufte

Esta é uma versão antiga do documento!

On Tuftefying gnuplot

Here are three examples of using gnuplot to visualize graphs in the style of Edward R. Tufte (see The Visual Display of Quantitative Information).

Quartile plot

The first is a quartile plot from page 125. The data file has entries

x minimum lower-quartile median upper-quartile maximum

A quartile plot combines two vectors plots for the lower and upper quartile and a point plot:

#!/usr/bin/gnuplot
set term svg
set output "tufte.svg"
unset border
set noxtics
set noytics
plot [0:11] [0:10] "./tufte.dat" using 1:2:(0):($3-$2) with vectors nohead ls -1 notitle,\
                   "" using 1:5:(0):($6-$5) with vectors nohead ls -1 notitle,\
                   "" using 1:4 with points pt 7 ps 0.75 lt -1 notitle

The result is

Temperature

The next plot shows the development of the earth's surface temperature. The data is from the NASA Goddard Institute for Space Studies. Each line contains

year minimum average maximum

The graph again combines a vector plot to show the total range and a point plot for the averages. Note the rangelimit option for the axes.

#!/usr/bin/gnuplot
set term svg enh
set output "monthly-averages.svg"
set title "Surface temperature from 1850-2009"
set ylabel "Different to average 1961-1990 [{}^oC]"
set xlabel "Year"
set border 3 front linetype -1 linewidth 1.000
set xtics border in nomirror rangelimit
set ytics border in nomirror rangelimit
plot "./monthly-averages.dat" using 1:2:(0):($4-$2) with vec nohead lt -1 notit, "" using 1:3 w p lt 1 ps 0.6 pt 7 notit

Bar chart

Here is the redesigned bar chart at the bottom of page 127. The data are simple y-values, one per line:

value

and

#!/usr/bin/gnuplot
set term svg enh
set output "barchart.svg"
unset border
unset xtics
set style line 1 linecolor rgbcolor "white" lw 2
set style line 2 linecolor rgbcolor "black"
set ytics 5,5,15 border nomirror format "%.0f%%"
set grid front ls 1
plot [-1:12] [0:20] "barchart.dat" using 0:1:(0.5) with boxes fill solid 0.4 noborder ls 2 notitle

produces

Locations of visitors to this page

tufte.1270081946.txt.gz · Esta página foi modificada pela última vez em: 2010/03/31 21:32 por marcus