CVC 2015

Glyphs and Data

In its original sense, in archeology, a glyph is a carved symbol.

Heiroglyph Mayan glyph

Data Glyph

A data glyph is also a mark, e.g.

The features of a data glyph encodes the value of variables.

  • Some are very simple, e.g. a dot:
  • Some combine different elements, e.g. a pointrange:
  • Some are complicated, e.g. a dotplot:

See: http://docs.ggplot2.org/current/

Data Glyph Properties: Aesthetics

Aesthetics are visual properties of a glyph.

  • Aesthetics for points: location (x and y), shape, color, size, transparency

  • Each glyph has its own set of aesthetics.

Why "Aesthetic"?

Some Graphics Components

glyph : The basic graphical unit that represents one case. Other terms used include mark and symbol.

aesthetic : a visual property of a glyph such as position, size, shape, color, etc.

  • may be mapped based on data values: sex -> color
  • may be set to particular non-data related values: color is black

scale : A mapping that translates data values into aesthetics.

  • example: male -> blue; female -> pink

frame : The position scale describing how data are mapped to x and y

guide : An indication for the human viewer of the scale. This allows the viewer to translate aesthetics back into data values.

  • Examples: x- and y-axes, various sorts of legends

Glyph-Ready Data

Glyph-ready data has this form:

  • There is one row for each glyph to be drawn.
  • The variables in that row are mapped to aesthetics of the glyph (including position)

Glyph-ready data

##   sbp dbp    sex  smoker
## 1 129  75   male   never
## 2 105  62 female   never
## 3 122  72   male   never
## 4 128  83 female  former
## 5 123  90   male  former
## 6 122  77   male current

Mapping of data to aesthetics

   sbp -> x      
   dbp -> y     
smoker -> color
   sex -> shape

Scales determine details of
data -> aesthetic translation

A few more elements

  1. Facets – using x and y twice
  2. Layers – building up to complex graphics
  3. Stats – data transformations

Facets – using x and y twice

  • x is determined by sbp and sex
  • basically a separate frame for each sex

Layers – building up complex plots

Each layer may have its own data, glyphs, aesthetic mapping, etc.

  • one layer has points
  • another layer has the curves

Stats: Data Transformations

  • What are the glyphs, aesthetics, etc. for this plot?
  • How is the data for this plot related to the "raw" data?
##   sbp dbp    sex smoker
## 1 129  75   male  never
## 2 105  62 female  never
## 3 122  72   male  never
## 4 128  83 female former

What's Next

  1. Eye-training

    • recognize and describe glyphs, aesthetics, scales, etc.
    • identify data required for a plot
  2. Data wrangling

    • get data into glyph-ready format (dplyr, tidyr)
  3. Graphics construction

    • describe data, glyphs, aesthetics, etc. to R (lattice, ggplot2)

Exercises

Start out with a GUI

Map variables to aesthetics with mplot()