/advanced-ggplot2-pearson

Material for the Pearson × O’Reilly Live Training Session "Hands-On Guide to Advanced Data Visualization with ggplot2: Custom Design"

Primary LanguageR

Material for the Pearson Live Training Session for O’Reilly
"Hands-On Guide to Advanced Data Visualization with ggplot2: Custom Design"

    Blog    Email    Twitter    Instagram    LinkedIn    Behance    BuyMeACoffee   


This is the second training of a two-part workshop series "Create Data Visualizations in R Using the Grammar of Graphics” in collaboration with Pearson and O'Reilly.


Course Set-up

Materials

To get a copy of all the material, clone this repository to a directory of your choice or download and unpack this zip folder.

Software

To run any of the materials locally on your own machine, you will need to install the following:

  • A recent version of R (download from here)
  • A recent version of RStudio (download from here)
  • A suite of R packages:
    • ggplot2
    • dplyr
    • forcats
    • stringr
    • scales
    • systemfonts
    • gapminder
    • rcartocolor
    • prismatic
    • ggrepel
    • ggforce
    • ggtext
    • patchwork
    • magick
    • ggdist
    • ggridges
    • plotly
    • ggiraph
    • echarts4r
    • gganimate

You can install all required R packages at once by running the following code in the R command line:

pkgs <- ("ggplot2","dplyr", "forcats", "stringr", "scales", "systemfonts", "gapminder",
         "rcartocolor", "prismatic", "ggrepel", "ggforce", "ggtext",  "patchwork", "magick",
         "ggdist", "ggridges", "plotly", "ggiraph", "echarts4r", "gganimate")
unavailable <- setdiff(pkgs, rownames(installed.packages()))
install.packages(unavailable)

To run the code, open up Rstudio. Copy–paste the code in the console pane (by default in the lower left) and hit enter. Several messages should pop up. Scan these messages that are returned for errors and troubleshoot them if necessary. Warnings and other informational messages can be ignored.

Fonts

We are using a non-default fonts in this session. If you want to run all code "as it is", please install the following typefaces which are available for free:

  • Roboto Condensed
  • Open Sans
  • Hepta Slab

You find the files in the fonts folder. Install them by double-clicking.

If you don't want to or can't install the fonts, it is still possible to run the code. Just make sure to replace the font families in the code with one that is installed on your system--or remove the respective rows (more information during the session).

For Mac Users

If you want to save your visualization to PDF, please make sure that XQuartz is installed which is needed to use the cairo pdf device.


Run the Codes

Double-click on the advanced-ggplot2-pearson.Rproj file which opens up Rstudio with the working directory set to the same folder (i.e. the directory where the Rproj file is placed).

Now, you can open any script from the files pane (by default in the lower right).

To follow the training, open the script advanced-ggplot2-pearson.R.