Cheatsheet Data Visualization
Cheatsheet Data Visualization
1
BASE GRAPHICS
“graphics” package Legends
The package used for Base Graphics in R is “graphics” legend(): controls the position of legends
hist(),boxplot() Univariate Analysis
plot() Bivariate Analysis
1 mfrow()
par()
Arrange n plots in a single plot
Set Graphical parameters
4
Univariate Analysis
boxplot() To study distribution of a continuous variable
3 • Scatter plots
• Entire dataset 5 Par(mfcol=c(2,2)) 4 plots
column-wise
VISUALIZATION USING ggplot2
Base Graphics vs ggplot2 Geoms with default stat and aesthetic
Geom Default Default Aesthetics
1 Base graphics
ggplot2
Good for simple tasks,difficult syntax
Simple syntax, interfaces with other
packages
Stat
5 geom_point
geom_histogra
“identity”
“bin”
colour,fill,shape,size,x,y
colour,fill,linetype,size,weight,x
Grammar of Graphics m
of elements is related with the data geom_boxplot “boxplot” colour, fill, lower, middle, size,
upper, weight, x,ymax, ymin
Geoms
(Geometrical
What geometrical objects appear on the
plot: points, lines, polygons, area, boxplot,
6 Note: Items in bold are required, others are optional and have
default values or are computed by a default stat transform
Objects) rectangle, tile etc
Statistical Compute density, counts, (Histogram: Need
Lorem Ipsum
Transformations
to bin and count data)
Univariate Analysis
Lorem ipsum dolor sit amet, nibh est. geom_boxplot() To study distribution of a continuous variable
Scales and
Coordinate
System
Discreet scale or Continous. Cartesian or
Spherical. 8 Frequency distribution of a continuous
geom_histogram() variable
geom_density() Density plots
VISUALIZATION USING ggplot/ggmap
Bivariate Analysis Maps in R
geom_point() Scatter plot
Facet Grid
2 Most useful when you have two discrete variables
3 7
4 8
CHEATSHEET TEMPLATE
Lorem Ipsum Lorem Ipsum
Lorem ipsum dolor sit amet, nibh est. Lorem ipsum dolor sit amet, nibh est.
1 5
Lorem Ipsum Lorem Ipsum
Lorem ipsum dolor sit amet, nibh est. Lorem ipsum dolor sit amet, nibh est.
2 6
Lorem Ipsum Lorem Ipsum
Lorem ipsum dolor sit amet, nibh est. Lorem ipsum dolor sit amet, nibh est.
3 7
Lorem Ipsum Lorem Ipsum
Lorem ipsum dolor sit amet, nibh est. Lorem ipsum dolor sit amet, nibh est.
4 8