# install.packages("esquisse") library(esquisse)
# install.packages("esquisse") library(esquisse)
The esquisse
package is helpful for getting used to creating plots in R.
It is an interactive tool to help you in RStudio.
It’s super nifty!
Using the esquisser()
function you can start creating a plot for a data.frame
or tibble
. That’s it!
esquisser(mtcars)
esquisse::esquisser(iris, viewer = "browser")
To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on.
To select variables you can drag and drop variables to the respective axis that you would like the variable to be plotted on.
esquisse
automatically assumes a plot type, but you might want to change this.
Facets create multiple plots based on the different values of a variable.
Sometimes it is useful to change the way points are plotted so that size represents a variable. This can especially be helpful if you need your plot to be black and white.
For plots with points use the color region to change coloring according to a variable. (use “fill” for bar plots)
You can change the overall appearance with the appearance tab.
Especially when you have a scatter plot, it can be helpful to add a smooth/trend line.
To change titles on your plot, use the titles tab.
You can also easily view data
You’ll need to “interrupt” Esquisse to launch it with a new dataset.
Use the stop button or press ctrl+c to stop the Esquisse app.
If you don’t see the stop button, you need to resize your window.
library(jhur) library(dplyr) wide_circ <- read_circulator() glimpse(wide_circ)
## Rows: 1,146 ## Columns: 15 ## $ day <chr> "Monday", "Tuesday", "Wednesday", "Thursday", "Friday… ## $ date <chr> "01/11/2010", "01/12/2010", "01/13/2010", "01/14/2010… ## $ orangeBoardings <dbl> 877, 777, 1203, 1194, 1645, 1457, 839, 999, 1023, 137… ## $ orangeAlightings <dbl> 1027, 815, 1220, 1233, 1643, 1524, 938, 1000, 1047, 1… ## $ orangeAverage <dbl> 952.0, 796.0, 1211.5, 1213.5, 1644.0, 1490.5, 888.5, … ## $ purpleBoardings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ purpleAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ purpleAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ greenBoardings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ greenAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ greenAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ bannerBoardings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ bannerAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ bannerAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ daily <dbl> 952.0, 796.0, 1211.5, 1213.5, 1644.0, 1490.5, 888.5, …
library(tidyr) long_circ <- wide_circ %>% pivot_longer( cols = contains(c("boarding")), names_to = "Route", values_to = "Boardings" )
glimpse(long_circ)
## Rows: 4,584 ## Columns: 13 ## $ day <chr> "Monday", "Monday", "Monday", "Monday", "Tuesday", "T… ## $ date <chr> "01/11/2010", "01/11/2010", "01/11/2010", "01/11/2010… ## $ orangeAlightings <dbl> 1027, 1027, 1027, 1027, 815, 815, 815, 815, 1220, 122… ## $ orangeAverage <dbl> 952.0, 952.0, 952.0, 952.0, 796.0, 796.0, 796.0, 796.… ## $ purpleAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ purpleAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ greenAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ greenAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ bannerAlightings <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ bannerAverage <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ daily <dbl> 952.0, 952.0, 952.0, 952.0, 796.0, 796.0, 796.0, 796.… ## $ Route <chr> "orangeBoardings", "purpleBoardings", "greenBoardings… ## $ Boardings <dbl> 877, NA, NA, NA, 777, NA, NA, NA, 1203, NA, NA, NA, 1…
esquisser(wide_circ) # days as x...? Tricky! esquisser(long_circ) # day as x, Boardings as y, Route as fill
esquisse
ggquickeda
: https://smouksassi.github.io/ggquickeda/ggraptR
: https://github.com/cargomoose/ggraptR/autoplot
can be helpful for some packages (see this blog post)esquisser()
function on a datasetviewer = "browser"
argument to launch in your browser.💻 Lab
Image by Gerd Altmann from Pixabay