Interactive Graphics with iplots stat 480
 Heike Hofmann

advertisement
Interactive Graphics
with iplots
stat 480
Heike Hofmann
Interactive Graphics
• Based on Linked Graphics
• Most important common tools: Selection & Highlighting, Identifying Points
• Plot-specific interactive tools
Install iplots
• For Windows:
install.packages(“iplots”)
• For Macs: download & install JGR from
http://rosuda.org/JGR/down.shtml
(includes iplots and depending packages)
• Help files & documentation:
http://www.rosuda.org/iplots/
iplots Graphics
help(library= “iplots”)
• iplot: Scatterplot
• ihist: Histogram
• ibar: Barchart
• ibox: Boxplot
• imosaic: Mosaicplot
• ipcp: Parallel Coordinate Plot
Select & Identify
• iset.selected()
gives index vector of current selection
• iset.select(indices)
highlights specified values in current data set
Your turn
• Open the RGui version 386
• Load the iplots package
• For the mtcars data, answer “is there a relationship in
the number of cylinders of a car and its mileage and/or
weight”?
For that, open several plots:
• a scatterplot of wt and mpg
• a barchart of the number of cylinders
• make use of linked highlighting to find out about a
possible relationship
Mosaicplots
• Area representation of contingency table
• Interactive tools: arrows re-organize order of
variables and #dimensions shown
Your turn
• load the tips data from http://www.ggobi.org/book/data/tips.csv
• Draw a mosaicplot of sex, smoker and day
• Try out different orders of the variables
• Explore relationship with tip size and total bill
(link to scatterplot)
Your turn: Whodunnit
• Dataset whodunnit contains “story”
• Load data set • Use interactive tools to figure out what
happened
• Once you know (or suspect) the story behind
this data, collect graphical evidence for your
theory.
Homework
• Identify what you think is the most likely
scenario of what happened in the whodunnit
data. • Prepare a mosaicplot of the data that supports
your scenario and • write a one page description of your scenario,
and describe how the mosaicplot backs it up
Data Sources for the
project?
• all government agencies have to report their data:
www.data.gov
or go to the agency/bureau directly, e.g.
• EPA has environmental/pollution data
• Census Bureau has information on people, and not
only how many there are :)
• CDC has health/disability/sickness statistics
• DOT has transportation statistics - how smooth are
things going? data on when things go wrong
Location of accidents with at least one fatality in 2012
Revisit some of our
sources?
• General Social Survey: http://www3.norc.org/
gss+website/
• Behavioral Risk Factor Surveillance System:
http://www.cdc.gov/brfss/annual_data/
annual_data.htm
• National Health and Nutritional Examination
Survey: http://www.cdc.gov/nchs/nhanes/
nhanes_questionnaires.htm
• Visualizing.org: http://www.visualizing.org/data/
browse
• Gapminder data: http://www.gapminder.org/data/
• World Statistics: http://datacatalog.worldbank.org/
Download