List of R packages to create and edit plots

December 4, 2015

plot R wiki

By

Kevin Cazelles

Nicolas Casajus

Steve Vissault

David Beauchesne


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 disqus section that follows the list.


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:

  1. 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.

  2. 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.

  3. Almost everything is possible. All graphics are fully customizable. Some time is required to learn the works, but it’s worth it.

  4. 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.

  5. 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. 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

  1. plotrix lots of plots, various labeling, axis and color scaling functions. CRAN
  2. gplots various R Programming Tools for Plotting Data. CRAN
  3. lattice R implementation of Trellis Graphics. CRAN
  4. ggplot2 an implementation of the grammar of graphics in R (see below for extensions). CRAN

Colors

  1. colorspace a package for color space manipulation. CRAN
  2. colourlovers Provides access to the COLOURlovers API, which offers color inspiration and color palettes. CRAN
  3. dichromat collapses red-green or green-blue distinctions to simulate the effects of different types of color-blindness. CRAN
  4. munsell provides easy access to, and manipulation of, the Munsell colours. CRAN
  5. RColorBrewer provides color schemes for maps (and other graphics) designed by Cynthia Brewer. CRAN
  6. RImagePalette extracts the dominant colors from an image, and turns them into a scale for use in plots or for fun! CRAN
  7. scales scale functions for visualization. CRAN
  8. viridis port of the new ‘matplotlib’ color maps to ‘R’ CRAN
  9. viridisLite viridis Lite version CRAN
  10. wesanderson palettes generated mostly from Wes Anderson movies. CRAN

Fonts

  1. extrafont tools to using fonts other than the standard PostScript fonts. CRAN
  2. showtext eases the use of fonts in R graphs. CRAN
  3. emojifont an implementation of using emoji font in both base and ‘ggplot2’ graphics. CRAN
  4. hexSticker an implementation of using emoji font in both base and ‘ggplot2’ graphics. CRAN

Extra plot functions

  1. ade4 multivariate data analysis of ecological data and graphical display associated. CRAN
  2. adegraphics graphical functionalities for the representation of multivariate data (complete re-implementation of the functions available in the ‘ade4’ package). CRAN
  3. aplpack a set of functions for drawing some special plots CRAN
  4. beanplot visualization via Beanplots. CRAN
  5. circlize provides an implementation of circular layout generation in R as well as an enhancement of available software. CRAN
  6. corrgram calculates correlation of variables and displays the results graphically. CRAN
  7. corrplot graphical display of a correlation matrix, confidence interval. CRAN
  8. dendextend offers a set of functions for extending dendrogram objects in R, letting you visualize and compare trees of hierarchical clusterings. CRAN
  9. denstrip density strips and other methods for compactly illustrating distributions. CRAN
  10. genoPlotR plot publication-grade gene and genome maps. CRAN
  11. heatmap3 provides improved heatmaps. CRAN
  12. hexbin binning and plotting functions for hexagonal bins. CRAN
  13. kohonen Functions to train supervised and self-organising maps (SOMs). CRAN
  14. pheatmap implementation of heatmaps that offers more control over dimensions and appearance CRAN
  15. riverplot implements Sankey or Ribbon plots. CRAN
  16. sinaplot enhanced chart for simple and truthful representation of single observations over multiple classes. CRAN
  17. sjPlot a collection of plotting and table output functions for data visualization dediacted to statistics in social science. CRAN
  18. vcd visualization techniques, data sets, summary and inference procedures aimed particularly at categoricaldata. CRAN
  19. Violin plot creates Violin plots. CRAN
  20. visreg visualization of regression models. CRAN

Clusters and trees

  1. ape analyses of Phylogenetics and Evolution, to draw a tree see plot.phylo() and plot.multiPhylo() functions. CRAN
  2. gclust orders panels in scatterplot matrices and parallel coordinate displays by some merit index. CRAN
  3. biclust algorithms to find biclusters in two-dimensional data, visualisation solutions are included. CRAN
  4. VisuClust visualisation of Clusters in Multivariate Data. CRAN

Plots in 3D

  1. plot3D functions for viewing 2-D and 3-D data, including perspective plots, slice plots, surface plots, scatter plots, etc. CRAN
  2. misc3d a collection of miscellaneous 3d plots, including isosurfaces. CRAN
  3. rgl implements 3D visualization using OpenGL. CRAN
  4. scatterplot3d plots a three dimensional (3D) point cloud. CRAN

Graph diagrams, flowcharts and networks

  1. DiagrammeR creates network graph diagrams. CRAN
  2. visNetwork network visualization, using ‘vis.js’ javascript library. CRAN
  3. diagram visualising simple graphs, flowcharts, and webs. CRAN
  4. igraph network analysis and visualization. CRAN
  5. qgraph visualizing data as networks as well as provides an interface for visualizing weighted graphical models. CRAN
  6. shape functions for plotting graphical shapes, colors. CRAN
  7. VennDiagram a set of functions to generate high-resolution Venn and Euler plots. CRAN

Maps

  1. cartography create and integrate maps in your R workflow. CRAN
  2. leafletR creates interactive web-maps based on the Leaflet JavaScript library. CRAN
  3. leaflet creates interactive web maps with the JavaScript ‘Leaflet’ library CRAN
  4. osmar a package to use Open Street Map in R. CRAN
  5. plotGoogleMaps accesses high resolution raster maps using the OpenStreetMap protocol. CRAN
  6. maps draws geographical maps. CRAN
  7. maptools a set of tools for manipulating and reading geographic data, in particular ESRI shapefiles. CRAN
  8. mapview interactive viewing of spatial data in R. CRAN
  9. micromap a package for linked micromaps. CRAN
  10. raster reading, writing, manipulating, analyzing and modeling of gridded spatial data. CRAN
  11. rgdal reads shapefiles and rasters using Frank Warmerdam’s Geospatial Data Abstraction Library. CRAN

Interactive graphics

  1. iplot interactive graphics for R. CRAN
  2. manipulate interactive plotting functions for use within RStudio. CRAN
  3. playwith a GUI for interactive plots using GTK+ CRAN
  4. rpanel simple interactive controls for R using the tcltk library. CRAN

Image importation and image processing

  1. bmp reads Windows BMP format images CRAN
  2. grImport a set of functions for converting, importing, and drawing PostScript pictures in R plots. CRAN
  3. imager Image Processing Library Based on ’CImg CRAN
  4. jpeg reads bitmap images stored in the JPEG format. CRAN
  5. pixmap functions for import, export, plotting and other manipulations of bitmapped images. CRAN
  6. png Reads bitmap images stored in the PNG format. CRAN

ggplot2 and extensions

  1. ggplot2 an implementation of the grammar of graphics in R. CRAN
  2. cowplot provide a publication-ready theme for ggplot2 CRAN
  3. ggthemes some extra themes, geoms, and scales for ‘ggplot2’ CRAN
  4. GGally extension to ggplot2. CRAN
  5. ggbeeswarm beeswarm-style plots with ggplot2. CRAN
  6. ggridges visualize changes in distributions over time or space. CRAN
  7. ggcorrplot visualization of a correlation matrix using ggplot2 CRAN
  8. ggdendro a set of tools for dendrograms and tree plots using ‘ggplot2’. CRAN
  9. gge creates biplots for GGE (genotype plus genotype-by-environment) and GGB (genotype plus genotype-by-block-of-environments) models. CRAN
  10. GGEBiplotGUI interactive GGE Biplots in R CRAN
  11. ggenealogy visualization tools for genealogical data. CRAN
  12. ggExtra adds marginal histograms to ggplot2, and more ggplot2 enhancements. CRAN
  13. ggiraph creates interactive ‘ggplot2’ graphics that are usable in the ‘RStudio’ viewer pane, in ‘R Markdown’ documents and in ‘Shiny’ apps. CRAN
  14. ggmap a collection of functions to visualize spatial data and models on top of static maps from various online sources. CRAN
  15. ggnetwork geometries to plot network objects with ‘ggplot2’. CRAN
  16. ggparallel creates hammock plots, parallel sets, and common angle plots with ggplot2. CRAN
  17. ggpmisc extensions to ‘ggplot2’ respecting the grammar of graphics paradigm. CRAN
  18. ggRandomForests graphic elements for exploring Random Forests. CRAN
  19. ggraptR allows Interactive Visualization of Data Through a Web Browser GUI. CRAN
  20. ggrepel provides text and label geoms for ‘ggplot2’ that help to avoid overlapping text labels. CRAN
  21. ggROC a package for roc curve plot with ggplot2. CRAN
  22. ggsci scientific journal and Sci-Fi themed volor palettes for ‘ggplot2’. CRAN
  23. ggseas seasonal adjustment on the fly extension for ggplot2. CRAN
  24. ggsn adds north symbols and scale bars to maps created with ‘ggplot2’ or ‘ggmap’. CRAN
  25. ggspectra extensions to ‘ggplot2’ for Radiation Spectra CRAN
  26. ggtern an Extension to ‘ggplot2’, for the creation of ternary diagrams. CRAN
  27. ggThemeAssist Rstudio add-in that delivers a graphical interface for editing ‘ggplot2’ theme elements. CRAN
  28. ggvis an implementation of an interactive grammar of graphics. CRAN
  29. 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

  1. arulesViz visualizing association rules and frequent itemsets. CRAN
  2. animation a gallery of animations in statistics and utilities to create animations. CRAN
  3. move visualizing and analyzing animal track data. CRAN
  4. personographs visualizes treatment effects using person icons, similar to Cates (NNT) charts. CRAN
  5. RGraphics data and functions from the book ‘R Graphics’, second edition. CRAN
  6. tagcloud generates tag and word clouds. CRAN
  7. tikzDevice Provides a graphics output device for R that records plots in a LaTeX-friendly format. CRAN
  8. tourr implements Tour methods in R code. CRAN
  9. wordcloud creates word clouds. CRAN
  10. wordcloud2 R interface to wordcloud for data visualization. CRAN

Web-based interactive charts

  1. dygraphs Interface to ‘Dygraphs’ interactive time series charting library. CRAN
  2. heatmaply Interactive Heat Maps Using ‘plotly’ CRAN
  3. highcharter R wrapper for highcharts. CRAN
  4. htmlwidgets a framework for easily creating R bindings to JavaScript libraries. CRAN
  5. manhattanly create interactive manhattan and Q-Q plots CRAN
  6. metricsgraphics Creates interactive charts with the JavaScript ‘MetricsGraphics’ library. CRAN
  7. networkD3 creates ‘D3’ ‘JavaScript’ network, tree, dendrogram, and Sankey graphs from ‘R’. CRAN
  8. plotly translates ‘ggplot2’ graphs to an interactive web-based version and/or creates custom web-based visualizations directly from R. CRAN
  9. qtlcharts Web-based interactive charts for the analysis of experimental crosses to identify genetic loci contributing to variation in quantitative traits. CRAN
  10. radarchart create interactive radar charts using the ‘Chart.js’ JavaScript library and the ‘htmlwidgets’ package. CRAN
  11. rCharts (not available on CRAN) creates, customizes and publishes interactive javascript visualizations from R using a familiar lattice style plotting interface. CRAN
  12. rbokeh R interface for Bokeh which renders plots using HTML canvas and provides many mechanisms for interactivity. CRAN
  13. scatterD3 creates ‘D3’ ‘JavaScript’ scatterplots from ‘R’ with interactive features. CRAN
  14. shiny web application framework for R. CRAN
  15. threeJS create interactive 3D scatter plots, network plots, and globes using the ‘three.js’ visualization library. CRAN

Trick or Tips 002 {R}

November 12, 2017

R tips

Gantt charts in R

September 20, 2017

R time management gantt

Efficiency of spatial intersects in R

September 12, 2017

R spatial intersection