May 21, 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

e.g. Point glyph: x, y, shape, color, size, transparency

Why "Aesthetic"?

Some Graphics Components

frame : The relationship between position and the data being plotted.

glyph : The basic graphical "unit" that represents one case. Other terms used include "mark" and "symbol." Variables set graphical attributes of the shape: size, color, shape, and so on. The location of the glyph — location is an important graphical attribute! — is set by the two variables defining the frame.

scale : The relationship between the value of a variable and the graphical attribute to be displayed for that value

guide : An indication for the human viewer of the scale, that is, graphics how a variable encodes into its graphical attribute. Common guides are x- and y-axis tick marks and color keys.

Glyph-Ready Data

Glyph-ready data has this form:

  • There is one row for each data glyph to be drawn.
  • The variables are those that make up the features of the glyph.
##   sbp dbp group react
## 1 117  70   Ctl   Sev
## 2  84  62   Ctl   Mod
## 3 151  54   Ctl   Mod
## 4 146  51   Ctl   Low
## 5 105  77   Ctl   Low
## 6 110 104   Ctl   Mod
##     x   y shape color
## 1 117  70   Ctl   Sev
## 2  84  62   Ctl   Mod
## 3 151  54   Ctl   Mod
## 4 146  51   Ctl   Low
## 5 105  77   Ctl   Low
## 6 110 104   Ctl   Mod

It's as if the variables were given the name of the aesthetic.

The Goal of Data Wrangling

  • Get your data into glyph-ready form.
  • "Glyph-ready" is also model-ready, descriptive-stats ready, and so on.

Graphics syntax

Lattice

xyplot(y ~ x, data = your_data_table)
histogram( ~ x, data = your_data_table)

That is:

Graphic Form ( variables , data = your_data_table)

ggplot2

ggplot(data = your_data_table) + geom_point(aes(x=x, y=y))
ggplot(data = your_data_table) + geom_histogram(aes(x=x))

Start out with a GUI

Map variables to aesthetics with mScatter(), mDistribution(), mBar() (mWorldMap()) [note: lattice graphics with mPlot()]

```r
require(DCF)
require(DCFinteractive)
DCFinteractive::mScatter( your_data_frame )   
```