Today’s Agenda

Relax! No hands-on coding today

👋 Quick intro

📊 Explore visuals & libraries

📚 Links to resources

✋ Q&A

A Non-Traditional Road

Anyone can learn R! Open source with a very supportive community.

Data Viz Workflows

Get Data

  • Read csv, xlsx

  • Web scrape

  • Connect DB

  • APIs

  • Data libraries

Prep Data

  • Clean

  • Filter

  • Aggregate

  • Reshape

Visualize

  • Static plots

  • Tables

  • Interactive viz

  • Maps

Deliver

  • Export as is

  • Embed in reports or site

  • Dashboards and apps

I’d like to introduce you to some of my favorite R packages…

Meet my bff ggplot2

  • Popular - a staple package in data viz R world

  • Versatile - build a variety of graphics (even maps!)

  • Customizeable - colors, scales, fonts, themes, etc.

  • Accessible - lots of learning resources available

If ggplot2 were a Pokémon, it would probably be Ditto. Ditto is able to transform into any Pokémon. Similarly, ggplot2 can be used to build a number of different plots and charts.

What is ggplot2?

ow to Slide from my ggplot2/plotnine workshop

Example of ggplot2 in action

Background

Libraries

  • ggplot2 - main plot

  • ggimage - plot images

  • ggtext - enhance text

  • sysfonts - import fonts

Behind the scenes process of creating my Doctor Who was Best? plot. Created with camcorder.

ggplot: Traditional Plots 📊

Line plot comparing Google search trends for ChatGPT vs. Lensa. Created with ggplot2 + geomtextpath. Data pulled directly from gtrendsR.

Bar Plot of top horror movies by total revenue. Created with ggplot2 + ggimage.

ggplot: Geospatial / Maps 🗺️

Basel, Switzerland map created with ggplot2, sf, and osmdata. Part of the #30DayMapChallenge.

Flag Colors Around The World created with ggplot2, combined with cowplot

ggplot: Pushing The Limits 🎨

You can use ggplot2 to create designs that are also out of the box…

Plot styled in the shape of a Nintendo Switch

Plot styled in the shape of an iPhone

More Packages: Creating Tables

Of course there’s plenty of room at the table for more favorites! reactable and gt are great for designing interactive tables.

Example of tables

  • reactablefmtr & gtExtras - add images, icons, color tiles, sparklines
  • Advanced styling with html code (htmltools, htmlwidgets)

Packages to explore for interactive visuals

highcharter

  • R wrapper for JS library highcharts
  • Create interactive visuals
  • My example with another #TidyTuesday dataset
  • Great examples with code on package site
  • Works well with shiny apps

leaflet

ggiraph - interactive ggplot2!

Include tooltips on hover and click events. View here.

shiny

Plug your interactive visuals into a shiny app! Here’s an app I created to analyze my Peloton workout data.

We all start somewhere…

Anything is plotsible, the trick is to start and keep trying. Throwback to my first ever #TidyTuesday plot

Thank You!

And that’s a wrap! More info on resources here.

We will now close with Q&A