Aesthetics

Everything up to this point gets you a basic graph; but what about colors, shapes and overall style?

You can change 5 basic aesthetics
1. Color- changes the outline color of your datapoints
2. Size - choose the size of the datapoint
3. Shape - choose a pre-defined shape
4. Alpha- changes the transparency of each point
5. Fill- changes the fill color of your points

Mapping these aesthetics to data

Beyond simply changing the size or color of the variables in your plot, you can encode more information by mapping these values to data in your data set.

Global vs Local {.build}

In ggplot2, we have the options to set mappings globally or locally. Setting a mapping globally means to set those values in the original ggplot function.

Example:

ggplot(r dataframe_name) +
geom_jitter(aes(x=r df_char1_name, y=r df_numeric1_name))+
geom_boxplot(aes(x=r df_char1_name, y=r df_numeric1_name))



matthewhirschey/bespokelearnr documentation built on Oct. 11, 2020, 12:57 a.m.