Ggplot2

Ggplot2

Fabrice Rossi

CEREMADE Universit? Paris Dauphine

2020

Outline

Introduction Core principles A tour of ggplot2 Extensions and other packages

2

Ggplot2



ggplot2 is a graphic system for R ggplot2 takes a declarative approach to graphics current standard for data science in R

divorced

married

single

count

400

education

primary

secondary

tertiary

200

unknown

0 30 50 70 90 30 50 70 90 30 50 70 90 age

3

Ggplot2

Pros

explain what you want not how to do it (declarative) high quality defaults (e.g. for colors) easy conditional analysis consistent presentation included best practices

Cons

rather steep learning curve (new logic compared to standard R plot)

data science oriented (needs a data frame)

difficult to customize in some circumstances

no interactivity

4

Principles

In ggplot, a plot is composed of a data set a mapping from some variables to aesthetics (graphical primitives) layers that compute summaries of the data (stats) layers that represent with graphical objects the data (geom) scales that transform values in the data space into values in the aesthetics a coordinate system a faceting specification for conditional analysis a theme which specifies details such as fonts and colormap

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download