-effective communication of complex quantitative ideas
clarity, precision, efficiency
Visual Encoding
position x, y
Length A, B, C
Angle
Visual Encoding: Direction, Shape, Area/Volume
Color: Hue, Saturation
Combination: min, max
Limit Hues
Plotting in Python
– Many packages
– matplotlib <- very popular
- ggplot <- use this, looks nicer, grammer of graphics
ggplot(data, qes(xvar, yvar)) + geom_point() + geom_line()
first step: create plot
second step: represent data with geometric objects
third step: add labels
from pandas import * from ggplot import * def lineplot(hr_year_csv): hr_year = pandas.read_csv(‘hr_year.csv’) print ggplot(hr_year, aes(‘yearID’, ‘HR’)) + geom_point(color=’red’) + geom_line(color=’red’) + ggtitle(‘Total HRs by Year’) + xlab(‘Year’) + ylab(‘HR’) if __name__ == ‘__main__’: lineplot()