Scales
Scales in ggplot2 control the mapping between data values and aesthetic properties. Here are some examples of how we can customize scales in ggplot2.
Function |
Description |
---|---|
scale_continuous() |
Customize the continuous axis scale. |
scale_discrete() |
Customize the discrete axis scale. |
scale_color_continuous() |
Customize the color scale for continuous data. |
scale_color_gradient() |
Customize the color scale using a gradient for continuous data. |
scale_color_brewer() |
Customize the color scale using predefined color palettes from RColorBrewer. |
scale_fill_gradientn() |
Customize the color scale using a multi-point gradient for continuous data. |
scale_color_viridis_c() |
Customize the color scale using the Viridis color palette. |
scale_color_hue() |
Customize the color scale using a circular hue gradient. |
scale_color_identity() |
Use the raw data values as color values. |
scale_color_grey() |
Customize the color scale using shades of grey. |
ggplot2 Cheat Sheet
Welcome to the ultimate ggplot2 cheat sheet! This is your go-to resource for mastering R’s powerful visualization package. With ggplot2, you can create engaging and informative plots effortlessly. Whether you’re a beginner or an experienced programmer, ggplot2’s popularity and versatility make it an essential skill to have in your R toolkit.
If you are new to ggplot2, this cheat sheet will help you get started. It covers the basics of ggplot2, including how to create a basic plot, add layers, and customize the appearance of your plots.