BehaviorCloud Logo
RRStudiodataviz

Top Data Visualization Packages for R: A Guide for 2023

ggplot2

ggplot2 provides the most feature-rich and versatile graph creation package based on the grammar of graphics framework as part of the robust tidyverse ecosystem. This principle breaks down graphs into components such as datasets, scales, levels, and so on. In a declarative manner, the user combines these components to describe and create any diagram.

This method has become so popular that it has effectively replaced R’s native diagrams and added several extensions, some of which will be discussed here.

This article is brought to you by CiteDrive: Are you writing reports in Quarto or R Markdown? Then you should look into CiteDrive, a project-based and collaborative web-reference management tool based on BibTeX that will assist you in keeping your citations, bibliographies, and references in sync with RStudio. Try out for free.

ggcorrplot

Visualization of a correlation matrix using ggplot2. It provides a solution for reordering the correlation matrix and displays the significance level on the correlation matrix.

ggExtra

This package adds additional geoms to ggplot2, along with functions to visualize and explore plots in more detail. For example, it can create marginal histograms/boxplots/density plots, useful for visualizing the distributions of x and y variables in scatterplots.

esquisse

The esquisse package provides a drag-and-drop interface for exploring and visualizing data. It generates ggplot2 code based on the user’s input and is integrated into RStudio as an addin.

patchwork

The patchwork package makes it extremely easy to combine multiple ggplot objects into one plot. It provides an intuitive and flexible way to create a composition of plots.

ggridges

Ggridges allows you to create ridgeline plots in ggplot2, which can be an effective way of visualizing changes in distributions across multiple groups or conditions.

ggforce

An extension of ggplot2 that brings additional geoms, stats and other components to ggplot.

dygraphs

An R interface to the Dygraphs JavaScript charting library. It provides rich facilities for charting time-series data and has built-in support for interactive exploration.

sunburstR

SunburstR creates ‘sunburst’ charts using a radial layout to display hierarchical data, which are effective for showing the structure of several levels of a tree-like dataset.

treemap

Treemap package provides an easy and flexible way to create treemaps for visualizing hierarchical data structures.

ggrepel

Ggrepel provides geoms for ggplot2 to repel overlapping text labels away from each other, and away from the data.

sf

The sf package is a modern approach to working with spatial data in R. It allows for the easy manipulation and visualization of simple feature objects (a standardized way of encoding spatial vector data).

Leaflet

The New York Times and the Washington Post both use Leaflet by Volodymyr Agafonkin, one of the most popular open-source JavaScript libraries for interactive maps. Leaflet for R makes it simple to incorporate leaflet maps into R.

simplevis

We’ve already introduced two useful tools: ggplot2 and leaflet. The goal of simplevis is to make visualization easier with less brainpower by providing a package of wrapper functions for these two packages.

GGANIMATE

gganimate is a ggplot extension that allows you to create diagrams with beautiful animations in R.

GGANIMATE EXAMPLE

The grammar principle is supplemented by a number of extra components that the data scientist can add to the ggplot object to represent how it should change over time.

ggvis

In keeping with the ggplot2 philosophy (and the grammar of graphics), ggvis allows users to create interactive graphics that can be tested in Rstudio or in the browser using the shiny infrastructure.

RGL

RGL allows you to create interactive 3D graphics in R using OpenGL or WebGL as the backend.

rayrender

This open-source R package, inspired by Peter Shirley’s three books on ray tracing, allows you to do the same thing when creating 3D scenes in R.

highcharter

This R package contains a set of wrapper functions for the JavaScript library of the same name. BBC, Sony, and Twitter are already using Highcharts (JavaScript) as a flexible and customizable chart library.

Plotly

The emphasis of Plotly is on interactive, publication-quality diagrams. There are examples for creating line charts, scatter plots, area plots, and so on.

Lattice

Lattice is a powerful and elegant high-level data visualization system inspired by Trellis graphics, with a focus on multivariate data. While adequate for most graphing needs, Lattice is adaptable enough to meet the majority of non-standard requirements.