ggplot2
gganimate
esquisse
ggplot2
plots to interactive plotly
plotsggrepel
ggplot2
There are many kinds of extensions to ggplot2
, but many of them can be put into one of two “bins”
ggplot2
Some packages add new layers or themes that can be combined with standard ggplot2
functions.
ggplot2
Other packages provide convenience “all-in-one” functions that combine multiple layers for you.
Browse the ggplot2
extensions gallery
Check out the Awesome ggplot2
list
Google search with “ggplot2” keyword
gganimate
gganimate
plotly
plotly
R package is interface to a JavaScript library for making interactive data visualizations
Only important to know that because if you search for plotly
help, sometimes you’ll get JavaScript code examples.
plotly
kind of uses the grammar of graphics, but building a plot from scratch is tricky
ggplotly()
transforms ggplot
objects into interactive plotly
plots. 90% of the time it gets you 90% of the way there
plotly
You can customize the info displayed in the tooltip with ggplotly()
. Give it additional aesthetic text
to include something only as a tooltip.
p2 <-
ggplot(penguins, aes(x = bill_length_mm, y = bill_depth_mm, color = species)) +
#Ignore unknown aesthetics warning
geom_point(aes(text = sex)) +
labs(x = "Bill length (mm)", y = "Bill depth (mm)", color = "Penguin Species") +
theme_bw()
ggplotly(p2, tooltip = c("text", "bill_depth_mm", "bill_length_mm"))
Warning
Output not shown because currently plotly
does not play nicely with Quarto revealjs slides (how this slide deck was made)
plotly
You can use ggplotly()
to make interactive animated plots by using the frame
aesthetic
Warning
Output not shown because currently plotly
does not play nicely with Quarto revealjs slides (how this slide deck was made)
esquisse
ggrepel
The ggrepel
package is helpful for directly labeling plots, especially when labels would otherwise overlap.
gganimate
: Getting started guide, reference
gplotly()
: https://plotly.com/ggplot2/
esquisse
: Getting started guide, reference
ggrepel
: Gallery of examples, list of available aesthetics you can map data to.
Our drop-in hours
Got a ggplot2
question we didn’t cover in this workshop series? Let’s figure it out together!