QCBS R workshop - Visualization

QCBS R workshop - Visualization

eric-pedersen

March 22, 2013

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

13 slides
  1. Plotting in Open Source Statistical Programming map courtesy of James

    Cheshire (spatialanalysis.co.uk/2012/02/great-maps-ggplot2/)
  2. * Challenge 1: Building a plot layer by layer 1.

    Use the 'iris' dataset to build the following three plots: a. A plot of Sepal.Length vs. Sepal.Width b. The same plot, but coloured by 'Species' c. A plot of Petal.Length vs. Species
  3. * Challenge 2: Playing with aesthetics and geoms 1. Use

    the qplot function and the 'iris' dataset to re- build the following three plots: a. A plot of Sepal.Length vs. Sepal.Width b. The same plot, but coloured by 'Species' c. A plot of Petal.Length vs. Species 2. For the plot in part 'c', try changing the geom argument to "boxplot". Try building a graph with both points and boxplot on them
  4. * Challenge 3: Faceting and scaling 1. Try to build

    the following plots using the iris data: a. Petal.Width vs. Petal.Height, faceted in a row by Species; and the same plot by column b. Sepal.Width vs. Sepal.Height, with the x-axis log-transformed, the y-axis log-transformed, and both axes log-transformed
  5. ggplot2: using the Grammar of Graphics ggplot2: a different way

    of plotting: building plots by describing what you want, and let it figure out how to plot it.
  6. ggplot2: using the Grammar of Graphics ggplot2: Builds plots out

    of simpler components: • data • aesthetics: e.g. coordinates, colour, size of points • geoms: the type of plot layer: line, point, etc. • facets: organizing graphs into subplots • transforms: logs, square roots, continuous to discrete etc. • stats: functions of the raw data • coordinates: e.g. Euclidean, map coords, polar • themes: font size, grids, etc.
  7. Further reading Plotting in general: R Graphics The R Book

    ggplot2 references: The creator, Hadley Wickham's website The in-depth documentation website The book: ggplot2: Elegant Graphics for Data Analysis

More Decks by eric-pedersen

Other Decks in Education