Student-solutions/Leif: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
=GNUPlot Visualization= | =GNUPlot Visualization= | ||
* [[Media:gnuplot-one-leif-revised.pdf|PDF Revised]] | |||
* [[Media:gnuplot-one-leif.pdf|PDF]] | * [[Media:gnuplot-one-leif.pdf|PDF]] | ||
* [http://cs.earlham.edu/~lnulric09/india-population.svg SVG] | * [http://cs.earlham.edu/~lnulric09/india-population.svg SVG] | ||
| Line 10: | Line 11: | ||
# F/K Fall 2012 | # F/K Fall 2012 | ||
# Functions | |||
WordSize(size) = 0.25*sqrt(sqrt(column(size))) | |||
Place(String,Size) = sprintf("{/=%d %s}", WordSize(Size), stringcolumn(String)) | |||
# Variables | |||
mapColor="#138900" | |||
bgColor="#4282d3" | |||
# Export Settings | # Export Settings | ||
## PDF | ## PDF | ||
set terminal postscript enhanced color | |||
set output '| ps2pdf - plot.pdf' | |||
## SVG | ## SVG | ||
set terminal svg | #set terminal svg | ||
set output 'india-population.svg' | #set output 'india-population.svg' | ||
# Reset | # Reset | ||
| Line 33: | Line 37: | ||
# Pre Plot Setup | # Pre Plot Setup | ||
set termoption enhanced | set termoption enhanced | ||
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb | set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb bgColor behind | ||
set border 0 | set border 0 | ||
set size square | set size square | ||
| Line 39: | Line 43: | ||
# Plot | # Plot | ||
plot 'india.csv' using 2:1 w filledcurves lc rgb | plot 'india.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'middle-andaman.csv' using 2:1 w filledcurves lc rgb | replot 'middle-andaman.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'little-anadman.csv' using 2:1 w filledcurves lc rgb | replot 'little-anadman.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'great-nicobar.csv' using 2:1 w filledcurves lc rgb | replot 'great-nicobar.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'amini.csv' using 2:1 w filledcurves lc rgb | replot 'amini.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'andrott.csv' using 2:1 w filledcurves lc rgb | replot 'andrott.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'other.csv' using 2:1 w filledcurves lc rgb | replot 'other.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'other2.csv' using 2:1 w filledcurves lc rgb | replot 'other2.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'other3.csv' using 2:1 w filledcurves lc rgb | replot 'other3.csv' using 2:1 w filledcurves lc rgb mapColor | ||
replot 'india-information.csv' using 29:28:(Place(1,5)) with labels | replot 'india-information.csv' using 29:28:($5 < 5000 ? "" : Place(1,5)) with labels | ||
reset | reset | ||
</pre> | </pre> | ||
=Sources= | |||
# GeoCommons - [http://geocommons.com/overlays/226411] | |||
# Kevin McCurley - [http://www.mccurley.org/svg] | |||
Latest revision as of 17:37, 8 November 2012
GNUPlot Visualization
Datasets
Code
# GNUPlot Visualization - Mapping the Population of India
# Leif DeJong
# F/K Fall 2012
# Functions
WordSize(size) = 0.25*sqrt(sqrt(column(size)))
Place(String,Size) = sprintf("{/=%d %s}", WordSize(Size), stringcolumn(String))
# Variables
mapColor="#138900"
bgColor="#4282d3"
# Export Settings
## PDF
set terminal postscript enhanced color
set output '| ps2pdf - plot.pdf'
## SVG
#set terminal svg
#set output 'india-population.svg'
# Reset
unset xtics
unset ytics
unset key
unset log
unset label
# Pre Plot Setup
set termoption enhanced
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb bgColor behind
set border 0
set size square
set datafile separator ","
# Plot
plot 'india.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'middle-andaman.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'little-anadman.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'great-nicobar.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'amini.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'andrott.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'other.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'other2.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'other3.csv' using 2:1 w filledcurves lc rgb mapColor
replot 'india-information.csv' using 29:28:($5 < 5000 ? "" : Place(1,5)) with labels
reset