• Home
  • Workshops
    • Overview
    • Scientific Writing
    • Peer Review
    • Proposal Writing
    • Online Workshops
  • Online Services
    • Writing Lab – NEW!
    • Writing Factory – Coming soon
  • About
    • Brian Cusack
    • Clients
  • Contact

Introducing the Grammar of Graphics Plotting Concept

In my recent talk at re:publica 14 in Berlin, I introduced the audience to the Grammar of Graphics((For a comprehensive introduction see Leland Wilkinson’s The Grammar of Graphics, 2nd Ed.)) plotting concept. This concept is implemented in the second day of our Data Visualisation workshop. So, what do we mean by the Grammar of Graphics? In a series of three posts, I will introduce the plotting concept and give two examples on how we can use it to better visually communicate quantitative data.

The Grammar of Graphics((This concept is implemented in R using the ggplot2 package. A recently introduced package for interactive graphics also makes use of this concept.)) allows us to understand quantitative plots as we intuitively understand grammar in language. For example, every word in the following sentence has a grammatical definition:

The quick brown fox jumps over the lazy dog.

The nouns (fox, dog) are like the quantitative variables we want to plot – they are the base from which we work and should remain consistent. However, changes in adjectives (quick, brown, lazy), verbs (jumps over) and articles (the) can dramatically change the sentence:

A rabid red fox bit the friendly dog.

Sentence structure dictates grammar, as in the case of the passive voice, where bit becomes was bitten by:

The friendly dog was bitten by a rabid red fox.

Sentences are elegant compositions of carefully-chosen grammatical elements that convey precise and clear messages. That is exactly what a quantitative plot is. Here, we work with seven, layered, grammatical elements. At least three layers are necessary:

  • Data
    • The actual variables to be plotted.
  • Aesthetics
    • The scales onto which we will map our data.
  • Geometries
    • Shapes used to represent our data.

 

ggplot-1

 

Within these three layers, we have an enormous amount of flexibility to make subtle changes to the plot, allowing us to clearly communicate a meaningful message. Once the foundation of our plot is established, we can define more advanced features:

  • Facets
    • Rows and columns of sub-plots.((This is akin to Tufte’s small multiples.))
  • Statistics
    • Statistical models & summaries.
  • Coordinates
    • The plotting space we are using.

 

ggplot-2

 

Finally, we can adjust design elements:

  • Theme
    • Describes non-data ink.

 

ggplot-3

This is the foundation of building flexible quantitative plots that convey truly meaningful messages. In the next two posts we will consider examples, one from the popular press and one from a scientific study, to show how the Grammar of Graphics is implemented in practice.









  • Search:

  • Categories

    • China
    • Data Analysis
    • Data Visualisation
    • Our Vision
    • Presentation Skills
    • Proposal Writing
    • Scientific Writing
    • Statistical Literacy
  • Popular Posts

    • Toolmaking We shape our tools, and thereafter our tools shape...
    • Science's Lingua Franca is a PatchworkThe dominance of English in science can obscure the contribution...
    • Why Use R? R's 3 Core Strengths: Simplicity, Power, FlexibilityIn my experience, most biologists justify their continued...



  • Contact
  • Impressum
  • Privacy Policy
© 2012-2018 by Science Craft, Berlin
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Read More
Privacy & Cookies Policy

Necessary Always Enabled