Note that the list of packages below would be updated as soon as we find a new
package. If you know a package that should be in the list, please feel mention
it in the comment section below.
Why use R to produce graphics?
S, R’s ancestor, was first designed to be an interactive interface for calling routines from the SCS (Statistical Computing Subroutines) FORTRAN library. It expanded to be a complete programming language dedicated to data manipulation, statistical analysis and data visualization (see A brief History of S). Today’s graphical system of R is directly derived from the one of S. When R is installed, you get from it two base packages, ‘graphics’ and ‘grid’, which produce graphics that are exported with the grDevices package. These packages are very complete and flexible. They allow users to efficiently create graphics that scientists use in their day to day operations, i.e. scatterplots, box plots, histograms, etc. We consider that the ‘graphics’ package is somewhat more user-friendly than the trickier ‘grid’ package which offers better facilities to develop new graphical functions (e.g. grid’ has been employed to build ggplot2). Recently, the gridGraphics package has been developed to bridge the gap between ‘grid’ and ‘graphics’ packages.
That being said, the advantages are numerous and more can be built in. For instance:
-
You get all the advantages linked with using R, i.e. it is free, lot of documentation exists, a very large community of users, there are many packages, it is easy to learn.
-
Any kind of graphics a scientist needs has already been implemented by many contributors (see the packages review below). If you find there is room for improvement or that we are mistaken, all information is available to further develop missing plotting functions or correct existing ones.
-
Almost everything is possible. All graphics are fully customizable. Some time is required to learn the works, but it’s worth it.
-
Although there may be many good reasons to use software to post-treat graphics R produces in WYSIWYG softwares, we contend that once you master R, you will never do so. When a graphics is done, it is associated with only a few lines of code. Changing solely the lines of code is a much more efficient way more efficient to solve any problem than reproducing and post-treating the graphics. As scientists, it is a victory to only modify a few lines of code when reviewers quibble about a figure.
-
Once a graphics is created, we can export it in many formats: .eps
, .jpeg
, .pdf
, .bmp
, .svg
with appropriate resolution and size. There is 100% guarantee that you will meet a journal’s requirements for figures publication.
Documentation
We will make the content below ’evolving’ by collecting and indexing as many sources of documentation as possible. Please comment in the Disqus section below to suggest and/or provide your own sources:
List of packages
Many packages for graphics are indexed in a dedicated task view maintained by Nicholas Lewin-Koh and many ggplot2 extensions are listed on ggplot2 extensions. We have indexed many of them and refer to more below. For each package, we provide:
- the name of the package with a link that goes to the CRAN repository where the manual and optional vignettes can be found,
- a text summarizing the package content (an adequate part of the description found online),
when available, we also provide :
- : a link that goes to the Github repository,
- : a link that goes to the associated Bitbucket repository,
- : a link that goes to the DOI link,
- : a link that goes to a dedicated website, a html vignette that describes well the package or a relevant publication,
- : a link that goes to an relevant pdf file (an R journal article for instance).
Main packages
- plotrix lots of plots, various labeling, axis and color scaling functions. CRAN
- gplots various R Programming Tools for Plotting Data. CRAN
- lattice R implementation of Trellis Graphics. CRAN
- ggplot2 an implementation of the grammar of graphics in R (see below for extensions). CRAN
Colors
- colorspace a package for color space manipulation. CRAN
- colourlovers Provides access to the COLOURlovers API, which offers color inspiration and color palettes. CRAN
- dichromat collapses red-green or green-blue distinctions to simulate the effects of different types of color-blindness. CRAN
- munsell provides easy access to, and manipulation of, the Munsell colours. CRAN
- RColorBrewer provides color schemes for maps (and other graphics) designed by Cynthia Brewer. CRAN
- RImagePalette extracts the dominant colors from an image, and turns them into a scale for use in plots or for fun! CRAN
- scales scale functions for visualization. CRAN
- viridis port of the new ‘matplotlib’ color maps to ‘R’ CRAN
- viridisLite viridis Lite version CRAN
- wesanderson palettes generated mostly from Wes Anderson movies. CRAN
Fonts
- extrafont tools to using fonts other than the standard PostScript fonts. CRAN
- showtext eases the use of fonts in R graphs. CRAN
- emojifont an implementation of using emoji font in both base and ‘ggplot2’ graphics. CRAN
- hexSticker an implementation of using emoji font in both base and ‘ggplot2’ graphics. CRAN
- ade4 multivariate data analysis of ecological data and graphical display associated. CRAN
- adegraphics graphical functionalities for the representation of multivariate data (complete re-implementation of the functions available in the ‘ade4’ package). CRAN
- aplpack a set of functions for drawing some special plots CRAN
- beanplot visualization via Beanplots. CRAN
- circlize provides an implementation of circular layout generation in R as well as an enhancement of available software. CRAN
- corrgram calculates correlation of variables and displays the results graphically. CRAN
- corrplot graphical display of a correlation matrix, confidence interval. CRAN
- dendextend offers a set of functions for extending dendrogram objects in R, letting you visualize and compare trees of hierarchical clusterings. CRAN
- denstrip density strips and other methods for compactly illustrating distributions. CRAN
- genoPlotR plot publication-grade gene and genome maps. CRAN
- heatmap3 provides improved heatmaps. CRAN
- hexbin binning and plotting functions for hexagonal bins. CRAN
- kohonen Functions to train supervised and self-organising maps (SOMs). CRAN
- pheatmap implementation of heatmaps that offers more control over dimensions and appearance CRAN
- riverplot implements Sankey or Ribbon plots. CRAN
- sinaplot enhanced chart for simple and truthful representation of single observations over multiple classes. CRAN
- sjPlot a collection of plotting and table output functions for data visualization dediacted to statistics in social science. CRAN
- vcd visualization techniques, data sets, summary and inference procedures aimed particularly at categoricaldata. CRAN
- Violin plot creates Violin plots. [CRAN](https://cran.r-project.org/web/packages/Violin plot)
- visreg visualization of regression models. CRAN
Clusters and trees
- ape analyses of Phylogenetics and Evolution, to draw a tree see
plot.phylo()
and plot.multiPhylo()
functions. CRAN
- gclust orders panels in scatterplot matrices and parallel coordinate displays by some merit index. CRAN
- biclust algorithms to find biclusters in two-dimensional data, visualisation solutions are included. CRAN
- VisuClust visualisation of Clusters in Multivariate Data. CRAN
Plots in 3D
- plot3D functions for viewing 2-D and 3-D data, including perspective plots, slice plots, surface plots, scatter plots, etc. CRAN
- misc3d a collection of miscellaneous 3d plots, including isosurfaces. CRAN
- rgl implements 3D visualization using OpenGL. CRAN
- scatterplot3d plots a three dimensional (3D) point cloud. CRAN
Graph diagrams, flowcharts and networks
- DiagrammeR creates network graph diagrams. CRAN
- visNetwork network visualization, using ‘vis.js’ javascript library. CRAN
- diagram visualising simple graphs, flowcharts, and webs. CRAN
- igraph network analysis and visualization. CRAN
- qgraph visualizing data as networks as well as provides an interface for visualizing weighted graphical models. CRAN
- shape functions for plotting graphical shapes, colors. CRAN
- VennDiagram a set of functions to generate high-resolution Venn and Euler plots. CRAN
Maps
- cartography create and integrate maps in your R workflow. CRAN
- leafletR creates interactive web-maps based on the Leaflet JavaScript library. CRAN
- leaflet creates interactive web maps with the JavaScript ‘Leaflet’ library CRAN
- osmar a package to use Open Street Map in R. CRAN
- plotGoogleMaps accesses high resolution raster maps using the OpenStreetMap protocol. CRAN
- maps draws geographical maps. CRAN
- maptools a set of tools for manipulating and reading geographic data, in particular ESRI shapefiles. CRAN
- mapview interactive viewing of spatial data in R. CRAN
- micromap a package for linked micromaps. CRAN
- raster reading, writing, manipulating, analyzing and modeling of gridded spatial data. CRAN
- rgdal reads shapefiles and rasters using Frank Warmerdam’s Geospatial Data Abstraction Library. CRAN
Interactive graphics
- iplot interactive graphics for R. CRAN
- manipulate interactive plotting functions for use within RStudio. CRAN
- playwith a GUI for interactive plots using GTK+ CRAN
- rpanel simple interactive controls for R using the tcltk library. CRAN
Image importation and image processing
- bmp reads Windows BMP format images CRAN
- grImport a set of functions for converting, importing, and drawing PostScript pictures in R plots. CRAN
- imager Image Processing Library Based on ‘CImg CRAN
- jpeg reads bitmap images stored in the JPEG format. CRAN
- pixmap functions for import, export, plotting and other manipulations of bitmapped images. CRAN
- png Reads bitmap images stored in the PNG format. CRAN
ggplot2 and extensions
- ggplot2 an implementation of the grammar of graphics in R. CRAN
- cowplot provide a publication-ready theme for ggplot2 CRAN
- ggthemes some extra themes, geoms, and scales for ‘ggplot2’ CRAN
- GGally extension to ggplot2. CRAN
- ggbeeswarm beeswarm-style plots with ggplot2. CRAN
- ggridges visualize changes in distributions over time or space. CRAN
- ggcorrplot visualization of a correlation matrix using ggplot2 CRAN
- ggdendro a set of tools for dendrograms and tree plots using ‘ggplot2’. CRAN
- gge creates biplots for GGE (genotype plus genotype-by-environment) and GGB (genotype plus genotype-by-block-of-environments) models. CRAN
- GGEBiplotGUI interactive GGE Biplots in R CRAN
- ggenealogy visualization tools for genealogical data. CRAN
- ggExtra adds marginal histograms to ggplot2, and more ggplot2 enhancements. CRAN
- ggforce ggforce is a package aimed at providing missing functionality to ggplot2 through the extension system introduced with ggplot2 v2.0.0. CRAN
- ggiraph creates interactive ‘ggplot2’ graphics that are usable in the ‘RStudio’ viewer pane, in ‘R Markdown’ documents and in ‘Shiny’ apps. CRAN
- ggmap a collection of functions to visualize spatial data and models on top of static maps from various online sources. CRAN
- ggnetwork geometries to plot network objects with ‘ggplot2’. CRAN
- ggparallel creates hammock plots, parallel sets, and common angle plots with ggplot2. CRAN
- ggpmisc extensions to ‘ggplot2’ respecting the grammar of graphics paradigm. CRAN
- ggRandomForests graphic elements for exploring Random Forests. CRAN
- ggraptR allows Interactive Visualization of Data Through a Web Browser GUI. CRAN
- ggrepel provides text and label geoms for ‘ggplot2’ that help to avoid overlapping text labels. CRAN
- ggROC a package for roc curve plot with ggplot2. CRAN
- ggsci scientific journal and Sci-Fi themed volor palettes for ‘ggplot2’. CRAN
- ggseas seasonal adjustment on the fly extension for ggplot2. CRAN
- ggsn adds north symbols and scale bars to maps created with ‘ggplot2’ or ‘ggmap’. CRAN
- ggspectra extensions to ‘ggplot2’ for Radiation Spectra CRAN
- ggtern an Extension to ‘ggplot2’, for the creation of ternary diagrams. CRAN
- ggThemeAssist Rstudio add-in that delivers a graphical interface for editing ‘ggplot2’ theme elements. CRAN
- ggvis an implementation of an interactive grammar of graphics. CRAN
- gg3D a ggplot2 extension enabling 3D projections. CRAN
- lemon functions for working with legends and axis lines of ‘ggplot2’, facets that repeat axis lines on all panels, and some ‘knitr’ extensions. CRAN
Miscellaneous
- arulesViz visualizing association rules and frequent itemsets. CRAN
- animation a gallery of animations in statistics and utilities to create animations. CRAN
- move visualizing and analyzing animal track data. CRAN
- personographs visualizes treatment effects using person icons, similar to Cates (NNT) charts. CRAN
- RGraphics data and functions from the book ‘R Graphics’, second edition. CRAN
- tagcloud generates tag and word clouds. CRAN
- tikzDevice Provides a graphics output device for R that records plots in a LaTeX-friendly format. CRAN
- tourr implements Tour methods in R code. CRAN
- wordcloud creates word clouds. CRAN
- wordcloud2 R interface to wordcloud for data visualization. CRAN
Web-based interactive charts
- dygraphs Interface to ‘Dygraphs’ interactive time series charting library. CRAN
- heatmaply Interactive Heat Maps Using ‘plotly’ CRAN
- highcharter R wrapper for highcharts. CRAN
- htmlwidgets a framework for easily creating R bindings to JavaScript libraries. CRAN
- manhattanly create interactive manhattan and Q-Q plots CRAN
- metricsgraphics Creates interactive charts with the JavaScript ‘MetricsGraphics’ library. CRAN
- networkD3 creates ‘D3’ ‘JavaScript’ network, tree, dendrogram, and Sankey graphs from ‘R’. CRAN
- plotly translates ‘ggplot2’ graphs to an interactive web-based version and/or creates custom web-based visualizations directly from R. CRAN
- qtlcharts Web-based interactive charts for the analysis of experimental crosses to identify genetic loci contributing to variation in quantitative traits. CRAN
- radarchart create interactive radar charts using the ‘Chart.js’ JavaScript library and the ‘htmlwidgets’ package. CRAN
- rCharts (not available on CRAN) creates, customizes and publishes interactive javascript visualizations from R using a familiar lattice style plotting interface. CRAN
- rbokeh R interface for Bokeh which renders plots using HTML canvas and provides many mechanisms for interactivity. CRAN
- scatterD3 creates ‘D3’ ‘JavaScript’ scatterplots from ‘R’ with interactive features. CRAN
- shiny web application framework for R. CRAN
- threeJS create interactive 3D scatter plots, network plots, and globes using the ’three.js’ visualization library. CRAN
- manipulateWidget add even more interactivity to interactive charts. CRAN