Related to GGPlot are two other visualization libraries that are worth looking into.
Plotly is a cross platform visualization library that is great for making interactive plots.
And GGPlotly provides a convenient way to translate GGPlot plots into Ploty plots.
Let quickly take a look at these.
First, lets install the Tidyverse and turn off warnings.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
options(warn =-1) # Turn off warnings
Plotly in R
Plotly runs on R, Python, JavaScript, and Matlab.
It uses the same model in each language, so learning it in R can help you use it in these other languages.
We first install it and then import it.
# install.packages("plotly")
library(plotly)
Attaching package: ‘plotly’
The following object is masked from ‘package:ggplot2’:
last_plot
The following object is masked from ‘package:stats’:
filter
The following object is masked from ‘package:graphics’:
layout
Here is a list of the kinds of plots you can create in Plotly: