Grammar of Graphics
Prepared by Thamalu Maliththa Piyadigama
for the TechTalk @ hSenid Mobile Solutions
Why Graphics?
Grammar of
Graphics
A layered object oriented
framework for graphic
generation
Leland
Wilkinson
Originally:
GPL (graphics processing language)
Supported by:
ggplot2 AntV G2
Layered
Grammar
Hadley
Wickham
Graph vs.
Graphics
Graph is an abstract
entity of points and it is
unperceivable.
Graphics are
what we can
see.
Deep
Structure
Surface
Structure
Why Deep Structure theory in
graphics?
Making Graphics Is All
About
Specify Assemble Display
Six specification statements
1. DATA
2. TRANS
3. SCALE
4. COORD
5. ELEMENT
6. GUIDE
ASSEMBLY
Is a relationship Has a relationship
Pipeline of Graphing
Variable
X=[ O, V, f ]
X is a variable
O is set of objects
F is mapping f:O V
Varset
X = [ V, Õ, f]
V = Values
Õ = Bag of Objects
f:V Õ
Data
1. Empirical Data
Realist, Nominalist, Operationalist
1. Abstract Data
Time Series, Counts
1. Meta Data
Time Series
Counts
Variable Transformations
Mathematical Statistical Multivariate
log exp tan … mean median …
Algebra
CROSS NEST BLEND
* / +
Example
A rural school has three grades 5,6,7.
Grade 5: 5A 5B
Grade 6: 6A 6B 6C
Grade 7: 7A 7B 7C
Data
Students are objects.
Each student has a grade
class and marks.
Student1
Grade 6 Class A
Marks1 35 Marks2 40
VARSETS
Grades = [ {5,6,7} , {students}, f1 ]
Class = [ {A,B,C}, {students} , f2 ]
Marks1 = [ {marks1} , {students}, f3 ]
Marks2 = [ {marks2} , {students}, f3 ]
CROSS
Nest
Cross & Nest
5 6 7
A 15 16 10
B 20 25 25
C 0- 20 30
Blend
Scales
Psychophysicist S.S.
Stevens initiate axiomatic
scale theory
“On the theory of scales of
measurement” (1946)
SI Scales
Length m
Time s
Mass kg
Luminosity cd
Current A
Temperature s
Substance mol
Statistics
Statistics changes the
points in a graph
Geometry
B ⊆ [a1,b1] ✕ [a2,b2] ✕ ...
F : Bm Rn
Collision Modifiers
Stack
Dodge
Jitter
Coordinates
Cartesian
Polar
Spherical
Cylindrical
Aesthetic
Gustav Fechner introduced
concept of Just Noticeable
Difference (JND)
Categories
Innate
Or
Learned?
Innate Categories
Prototype Theory
Vs
Exemplar theory
Realism of
Categories
James G. Gibson said
we should first consider
environmental
constancies of the
perceiving interaction.