Esta página mostra as diferenças entre as duas revisões da página.
| Ambos os lados da revisão anterior Revisão anterior Próxima revisão | Revisão anterior | ||
|
tufte [2010/01/23 11:25] marcus |
tufte [2010/04/01 19:41] (Actual) marcus |
||
|---|---|---|---|
| Linha 1: | Linha 1: | ||
| - | Here are two examples of using [[http://www.gnuplot.info|gnuplot]] to visualize graphs in the style proposed by Edward R. Tufte in [[http://www.edwardtufte.com/tufte/books_vdqi|The Visual Display of Quantitative Information]]. | + | ==== On Tuftefying gnuplot ==== |
| - | === Quartile plots === | + | Here are four examples of using [[http://www.gnuplot.info|gnuplot]] to visualize graphs in the style of Edward R. Tufte (see [[http://www.edwardtufte.com/tufte/books_vdqi|The Visual Display of Quantitative Information]]). |
| + | |||
| + | === Quartile plot === | ||
| The first is a quartile plot from page 125. The [[tufte.dat|data file]] has entries | The first is a quartile plot from page 125. The [[tufte.dat|data file]] has entries | ||
| <code> | <code> | ||
| Linha 10: | Linha 12: | ||
| <code> | <code> | ||
| - | #!/usr/bin/gnuplot -persist | + | #!/usr/bin/gnuplot |
| set term svg | set term svg | ||
| set output "tufte.svg" | set output "tufte.svg" | ||
| Linha 20: | Linha 22: | ||
| "" using 1:4 with points pt 7 ps 0.75 lt -1 notitle | "" using 1:4 with points pt 7 ps 0.75 lt -1 notitle | ||
| </code> | </code> | ||
| + | |||
| + | The result is | ||
| {{:tufte.png}} | {{:tufte.png}} | ||
| + | |||
| + | === Temperature === | ||
| + | |||
| + | The next plot shows the development of the earth's surface temperature. The [[monthly-averages.dat|data]] is from the [[http://www.giss.nasa.gov|NASA Goddard Institute for Space Studies]]. Each line contains | ||
| + | <code> | ||
| + | year minimum average maximum | ||
| + | </code> | ||
| + | |||
| + | 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. | ||
| + | |||
| + | <code> | ||
| + | #!/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 | ||
| + | </code> | ||
| + | |||
| + | {{:monthly-averages.png}} | ||
| + | |||
| + | |||
| + | === Bar chart === | ||
| + | Here is the redesigned bar chart at the bottom of page 127. The data are simple y-values, one per line: | ||
| + | <code> | ||
| + | value | ||
| + | </code> | ||
| + | and | ||
| + | <code> | ||
| + | #!/usr/bin/gnuplot | ||
| + | set term svg enh | ||
| + | set output "barchart.svg" | ||
| + | unset xtics | ||
| + | set style line 1 linecolor rgbcolor "white" lw 2 | ||
| + | set style line 2 linecolor rgbcolor "#808080" lw 2 | ||
| + | set border 1 ls 2 | ||
| + | set ytics 5,5,15 border nomirror format "%.0f%%" font "Times_New_Roman,18" textcolor rgbcolor "black" offset -2 out scale 2.0 | ||
| + | set grid front ls 1 | ||
| + | plot [-1:11.25] [0:20] "barchart.dat" using 0:1:(0.5) with boxes fill solid 1.4 noborder ls 2 notitle | ||
| + | </code> | ||
| + | produces | ||
| + | |||
| + | {{:barchart.png?480}} | ||
| + | |||
| + | === Dot-dash-plot === | ||
| + | |||
| + | And finally, a dot-dash-plot in the style of p. 133. (The data are xy value pairs). | ||
| + | |||
| + | <code> | ||
| + | #!/usr/bin/gnuplot -persist | ||
| + | set term svg enh | ||
| + | set output "dotdash.svg" | ||
| + | unset border | ||
| + | set xtics textcolor rgb "white" out nomirror | ||
| + | set ytics textcolor rgb "white" out nomirror | ||
| + | set offsets 0.005, 0, 0, 1 | ||
| + | plot "dotdash.dat" using 1:2:xtic(1):ytic(sprintf("%f",$2)) pt 7 ps 1 notitle | ||
| + | </code> | ||
| + | |||
| + | produces | ||
| + | |||
| + | {{:dotdash.png}} | ||
| + | |||
| + | <html> | ||
| + | <a href="http://www2.clustrmaps.com/counter/maps.php?url=http://www.inf.ufrgs.br/~mrpritt" id="clustrMapsLink"><img width=1 src="http://www2.clustrmaps.com/counter/index2.php?url=http://www.inf.ufrgs.br/~mrpritt" style="border:1px solid;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onError="this.onError=null; this.src='http://clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://clustrmaps.com'" /> | ||
| + | </a> | ||
| + | </html> | ||