OrgPad logo

GGPLOT2

Created by Silvie Cinková

GGPLOT2

geom_

geom = geometric object

They control the type of plot you create. 

Each geom has a set of aesthetics it understands, some of them are obligatory.

Every geom has a default statistic (and every statistic has a default geom). 

A visual survey of Text Visualization Techniques

Text Visualisation Browser

(IEEE PacificVis 2015 short paper)

 

 

TrustMLVis BrowserA Visual Survey in Enhancing Trust in Machine Learning (ML) Models with Visualization (CGF survey article) Provided by ISOVIS group

Hong2016Han2016Heimerl2016 2

geom_point()

image

geom_jitter()

image

geom_boxplot()

image

geom_histogram()

image

geom_bar()

image

geom_raster()

image

geom_violin()

ggplot(mtcars, 
aes(x = factor(cyl), y = mpg, fill = factor(cyl))) +
geom_violin()

unnamed-chunk-1-1

geom_line()

image925a91ca-8d92-4cb1-90ad-2512a5fa1a5c

geom_text()

image86cd784a-07bf-4af2-a5e6-d223492fde6a

geom_density()

image

geom_freqpoly

image

Position: Parameter and Functions

This parameter occurs only inside geoms, and not all of them. 

it can have either a string value (look it up, but e.g. "jitter", "dodge", "stack", "fill"), or call a function from the family of 

function_XXXX. 

 

 

x

y

size

color

mtcars

image

image

data frame, tibble

Examples

iris

iris %>% filter(Species == "setosa")

 

mappings = aes(<MAPPINGS>)

line

shape

group

alpha

label

Data

Aesthetics

Each plot must have filled out the mappings parameter. It comes either directly into the initial ggplot() function, following the data parameter, or inside a geom_xxx() function.

The only possible value of the mappings parameter is the aes() function. In it, you map your variable on diverse aesthetic scales:

scale functions - independent functions, write them after + like e.g. geom_

ORGPAD_GEOMS.Rmd

Geometries

Facets

image

ggplot2 cheatsheet

CHEATSHEET

Statistics

Coordinates

Themes

coord_

coord_flip()