34 Translating custom ggplot2 geoms

Version 2.0.0 of ggplot2 introduced a way for other R packages to implement custom geoms. Some great examples include: ggrepel, ggalt, ggraph, geomnet, ggmosaic and ggtern (Rudis 2016; Pedersen 2016; Tyner and Hofmann 2016; Jeppson, Hofmann, and Cook 2016; Hamilton 2016).49 Although the ggplotly() function translates most of the geoms bundled with the ggplot2 package, it has no way of knowing about the rendering rules for custom geoms. The plotly package does, however, provide 2 generic functions based on the S3 scheme that can leveraged to inform ggplotly() about these rules (Chambers 1992).50 To date, the ggmosaic and ggalt packages have taken advantage of this infrastructure to provide translations of their custom geoms to plotly.

In ggplot2, many geoms are special cases of other geoms. For example, geom_line() is equivalent to geom_path() once the data is sorted by the x variable. For cases like this, when a geom can be reduced to another lower-level (i.e., basic) geom, authors just have to write a method for the to_basic() generic function in plotly. In fact, within the package itself, the to_basic() function has a GeomLine method which simply sorts the data by the x variable then returns it with a class of GeomPath prefixed.

getS3method("to_basic", "GeomLine")
#> function (data, prestats_data, layout, params, p, ...) 
#> {
#>     data <- data[order(data[["x"]]), ]
#>     prefix_class(data, "GeomPath")
#> }
#> <bytecode: 0x7fe6a7802e08>
#> <environment: namespace:plotly>

If you have implemented a custom geom, say GeomCustom, rest assured that the data passed to to_basic() will be of class GeomCustom when ggplotly() is called on a plot with your geom. And assuming GeomCustom may be reduced to another lower-level geom support by plotly, a to_basic.GeomCustom() method that transforms the data into a form suitable for that lower-level geom is sufficient for adding support. Moreover, note that the data passed to to_basic() is essentially the last form of the data before the render stage and after statistics have been performed. This makes it trivial to add support for geoms like GeomXspline from the ggalt package.

getS3method("to_basic", "GeomXspline")
function(data, prestats_data, layout, params, p, ...) {
  data <- data[order(data[["x"]]), ]
  prefix_class(data, "GeomPath")

As shown in Figure 34.1, once the conversion has been provided. Users can call ggplotly() on the ggplot object containing the custom geom just like any other ggplot object.

# example from `help(geom_xspline)`
dat <- data.frame(
  x = c(1:10, 1:10, 1:10),
  y = c(
    sample(15:30, 10), 
    2 * sample(15:30, 10), 
    3 * sample(15:30, 10)
  group = factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
p <- ggplot(dat, aes(x, y, group = group, color = factor(group))) +
  geom_point(color = "black") +
  geom_smooth(se = FALSE, linetype = "dashed", size = 0.5) +
  geom_xspline(spline_shape = 1, size = 0.5)
ggplotly(p) %>% hide_legend()
Converting GeomXspline from the ggalt package to plotly.js via ggplotly().

FIGURE 34.1: Converting GeomXspline from the ggalt package to plotly.js via ggplotly().

In more complicated cases, where your custom geom can not be converted to a lower level geom, a custom method for the geom2trace() generic is required (methods(geom2trace) lists all the basic geoms that we natively support). This method should involve a conversion from a data frame to a list-like object conforming to the plotly.js figure reference.

Ahlberg, Christopher, Christopher Williamson, and Ben Shneiderman. 1991. “Dynamic Queries for Information Exploration: An Implementation and Evaluation.” In ACM Chi ’92 Conference Proceedings, 21:619–26.

Allaire, JJ. 2016. Flexdashboard: R Markdown Format for Flexible Dashboards. https://CRAN.R-project.org/package=flexdashboard.

Asimov, Daniel. 1985. “The Grand Tour: A Tool for Viewing Multidimensional Data.” SIAM J. Sci. Stat. Comput. 6 (1): 128–43. https://doi.org/10.1137/0906011.

Auguie, Baptiste. 2016. GridExtra: Miscellaneous Functions for "Grid" Graphics. https://CRAN.R-project.org/package=gridExtra.

Bache, Stefan Milton, and Hadley Wickham. 2014. Magrittr: A Forward-Pipe Operator for R. https://CRAN.R-project.org/package=magrittr.

Berkeley Institute for Data Science. 2016. “Mpl Colormaps.” 2016. http://web.archive.org/web/20160601125258/http://bids.github.io/colormap/.

Bostock, Jeffrey Heer AND Michael. 2010. “Crowdsourcing Graphical Perception: Using Mechanical Turk to Assess Visualization Design.” In ACM Human Factors in Computing Systems (Chi), 203–12. http://vis.stanford.edu/papers/crowdsourcing-graphical-perception.

Bryan, Jennifer. 2015. Gapminder: Data from Gapminder. https://CRAN.R-project.org/package=gapminder.

Buja, Andreas, John Alan McDonald, John Michalak, and Werner Stuetzle. 1991. “Interactive data visualization using focusing and linking.” IEEE Proceedings of Visualization, February, 1–8.

Chamberlain, Scott, and Andy Teucher. 2018. Geojsonio: Convert Data from and to ’Geojson’ or ’Topojson’. https://CRAN.R-project.org/package=geojsonio.

Chambers, J. M. 1992. “Classes and Methods: Object-Oriented Programming in S.” In Statistical Models in S, edited by J. M. Chambers and T. J. Hastie. Wadsworth & Brooks/Cole.

Chang, Winston. 2016. Webshot: Take Screenshots of Web Pages. https://CRAN.R-project.org/package=webshot.

———. 2017. “Interactive Plots (in Shiny).” Blog. http://shiny.rstudio.com/articles/plot-interaction.html.

Chang, Winston, and Barbara Borges Ribeiro. 2018. Shinydashboard: Create Dashboards with ’Shiny’. https://CRAN.R-project.org/package=shinydashboard.

Chang, Winston, and Javier Luraschi. 2018. Profvis: Interactive Visualizations for Profiling R Code. https://CRAN.R-project.org/package=profvis.

Cheng, Joe. 2018a. “Case Study: Converting a Shiny App to Async.” Blog. https://rstudio.github.io/promises/articles/casestudy.html.

———. 2018b. Promises: Abstractions for Promise-Based Asynchronous Programming. https://CRAN.R-project.org/package=promises.

———. 2018c. Using Leaflet with Shiny. Blog. https://rstudio.github.io/leaflet/shiny.html.

Cleveland, William S., and Ryan Hafen. 2014. “Divide and Recombine: Data Science for Large Complex Data.” Statistical Analysis and Data Mining: The ASA Data Science Journal 7 (6): 425–33.

Cleveland, William S, and Robert McGill. 1984. “Graphical Perception: Theory, Experimentation, and Application to the Development of Graphical Methods.” Journal of the American Statistical Association 79 (September): 531–54.

Cook, Dianne, Andreas Buja, and Deborah F Swayne. 2007. “Interactive High-Dimensional Data Visualization.” Journal of Computational and Graphical Statistics, December, 1–23.

Cook, Dianne, and Deborah F. Swayne. 2007. Interactive and Dynamic Graphics for Data Analysis : With R and Ggobi. Use R ! New York: Springer. http://www.ggobi.org/book/.

Cook, Di, Anthony Ebert, Heike Hofmann, Rob Hyndman, Thomas Lumley, Ben Marwick, Carson Sievert, et al. 2017. Eechidna: Exploring Election and Census Highly Informative Data Nationally for Australia. https://CRAN.R-project.org/package=eechidna.

Curley, James. 2016. Engsoccerdata: English and European Soccer Results 1871-2016. https://CRAN.R-project.org/package=engsoccerdata.

Dang, Tuan Nhon, and Leland Wilkinson. 2012. “Timeseer: Detecting interesting distributions in multiple time series data.” VINCI, October, 1–9.

de Jong, Jos, and Kenton Russell. 2016. Listviewer: ’Htmlwidget’ for Interactive Views of R Lists. https://github.com/timelyportfolio/listviewer.

Dipert, Alan, Barret Schloerke, and Barbara Borges. 2018. Shinyloadtest: Load Test Shiny Applications.

Dorling, D. 1996. “Area Cartograms: Their Use and Creation.” Concepts and Techniques in Modern Geography (CATMOG).

Emerson, John W., Walton A. Green, Barret Schloerke, Jason Crowley, Dianne Cook, Heike Hofmann, and Hadley Wickham. 2013. “The Generalized Pairs Plot.” Journal of Computational and Graphical Statistics 22 (1): 79–91. https://doi.org/10.1080/10618600.2012.694762.

Few, Stephen. 2006. “Data Visualization: Rules for Encoding Values in Graph.” 2006. https://web.archive.org/web/20160404214629/http://www.perceptualedge.com/articles/b-eye/encoding_values_in_graph.pdf.

Freedman, D., and P. Diaconis. 1981. “On the Histogram as a Density Estimator: L2 Theory.” Zeitschrift Für Wahrscheinlichkeitstheorie Und Verwandte Gebiete 57: 453–76.

Galili, Tal. 2016. Heatmaply: Interactive Heat Maps Using ’Plotly’. https://CRAN.R-project.org/package=heatmaply.

Guha, Saptarshi, Ryan Hafen, Jeremiah Rounds, Jin Xia, Jianfu Li, Bowei Xi, and William S. Cleveland. 2012. “Large Complex Data: Divide and Recombine with Rhipe.” The ISI’s Journal for the Rapid Dissemination of Statistics Research, August, 53–67.

Hafen, R., L. Gosink, J. McDermott, K. Rodland, K. K. V. Dam, and W. S. Cleveland. 2013. “Trelliscope: A System for Detailed Visualization in the Deep Analysis of Large Complex Data.” In Large-Scale Data Analysis and Visualization (Ldav), 2013 Ieee Symposium on, 105–12. https://doi.org/10.1109/LDAV.2013.6675164.

Hafen, Ryan. 2016. Trelliscope: Create and Navigate Large Multi-Panel Visual Displays. https://CRAN.R-project.org/package=trelliscope.

Hafen, Ryan, and Barret Schloerke. 2018. Trelliscopejs: Create Interactive Trelliscope Displays. https://github.com/hafen/trelliscopejs.

Hamilton, Nicholas. 2016. Ggtern: An Extension to ’Ggplot2’, for the Creation of Ternary Diagrams. https://CRAN.R-project.org/package=ggtern.

Harrell Jr, Frank E, with contributions from Charles Dupont, and many others. 2019. Hmisc: Harrell Miscellaneous. https://CRAN.R-project.org/package=Hmisc.

Healey, Kieran. 2018. Data Visualization: A Practical Introduction. Princeton University Press. https://kieranhealy.org/publications/dataviz/.

Heer, Dominik Moritz AND Bill Howe AND Jeffrey. 2019. “Falcon: Balancing Interactive Latency and Resolution Sensitivity for Scalable Linked Visualizations.” In ACM Human Factors in Computing Systems (Chi). http://idl.cs.washington.edu/papers/falcon.

Heer, Jeffrey, Maneesh Agrawala, and Wesley Willett. 2008. “Generalized Selection via Interactive Query Relaxation.” In Proceedings of the Sigchi Conference on Human Factors in Computing Systems, 959–68. ACM.

Heer, Michael Bostock AND Vadim Ogievetsky AND Jeffrey. 2011. “D3: Data-Driven Documents.” IEEE Trans. Visualization & Comp. Graphics (Proc. InfoVis). http://vis.stanford.edu/papers/d3.

Heer, Zhicheng Liu AND Biye Jiang AND Jeffrey. 2013. “ImMens: Real-Time Visual Querying of Big Data.” Computer Graphics Forum (Proc. EuroVis) 32 (3). http://idl.cs.washington.edu/papers/immens.

Heer, Zhicheng Liu AND Jeffrey. 2014. “The Effects of Interactive Latency on Exploratory Visual Analysis.” IEEE Trans. Visualization & Comp. Graphics (Proc. InfoVis). http://idl.cs.washington.edu/papers/latency.

Hester, Jim, Kirill Müller, Kevin Ushey, Hadley Wickham, and Winston Chang. 2018. Withr: Run Code ’with’ Temporarily Modified Global State. https://CRAN.R-project.org/package=withr.

Hijmans, Robert J. 2019. Raster: Geographic Data Analysis and Modeling. https://CRAN.R-project.org/package=raster.

Hyndman, Rob J. 2018. Forecast: Forecasting Functions for Time Series and Linear Models. http://github.com/robjhyndman/forecast.

Ihaka, Ross, Paul Murrell, Kurt Hornik, Jason C. Fisher, Reto Stauffer, Claus O. Wilke, Claire D. McWhite, and Achim Zeileis. 2019. colorspace: A Toolbox for Manipulating and Assessing Colors and Palettes. https://CRAN.R-project.org/package=colorspace.

Inc, Facebook, Kent Russell, and Alan Dipert. 2019. ReactR: React Helpers. https://CRAN.R-project.org/package=reactR.

James A. Dougenik, Nicholas R. Chrisman, Duane R. Niemeyer. 1985. “An Algorithm to Construct Continuous Area Cartograms.” The Professional Geographer.

Jeppson, Haley, Heike Hofmann, and Di Cook. 2016. Ggmosaic: Mosaic Plots in the ’Ggplot2’ Framework. http://github.com/haleyjeppson/ggmosaic.

Jeworutzki, Sebastian. 2018. Cartogram: Create Cartograms with R. https://CRAN.R-project.org/package=cartogram.

J. W. Tukey, J. H. Friedman, and M. A. Fisherkeller. 1973. “Stanford Linear Accelerator.” http://stat-graphics.org/movies/prim9.html.

Karambelkar, Bhaskar. 2017. Widgetframe: ’Htmlwidgets’ in Responsive ’Iframes’. https://CRAN.R-project.org/package=widgetframe.

Lander, Jared P. 2016. Coefplot: Plots Coefficients from Fitted Models. https://CRAN.R-project.org/package=coefplot.

Leeper, Thomas J. 2017. Slopegraph: Edward Tufte-Inspired Slopegraphs.

Lins, Lauro, James T. Klosowski, and and Carlos Scheidegger. 2013. “Nanocubes for Real-Time Exploration of Spatiotemporal Datasets.” Visualization and Computer Graphics, IEEE Transactions.

Mastny, Timothy. 2018. Sass: Syntactically Awesome Stylesheets (Sass) Compiler. https://github.com/rstudio/sass.

Messing, Solomon. 2012. “Visualization Series: Insight from Cleveland and Tufte on Plotting Numeric Data by Groups.” 2012. http://web.archive.org/web/20160602202734/https://solomonmessing.wordpress.com/2012/03/04/visualization-series-insight-from-cleveland-and-tufte-on-plotting-numeric-data-by-groups/.

Mildenberger, Thoralf, Yves Rozenholc, and David Zasada. 2009. Histogram: Construction of Regular and Irregular Histograms with Different Options for Automatic Choice of Bins. https://CRAN.R-project.org/package=histogram.

Mullen, Lincoln A., and Jordan Bratt. 2018. “USAboundaries: Historical and Contemporary Boundaries of the United States of America.” Journal of Open Source Software 3 (23): 314. https://doi.org/10.21105/joss.00314.

Murray, Scott. 2013. Interactive Data Visualization for the Web: An Introduction to Designing with D3. O’Reilly.

———. 2017. D3.js in Action. Manning.

Newman, Mark. 2016. “Maps of the 2016 Us Presidential Election Results.” Blog. http://www-personal.umich.edu/~mejn/election/2016/.

Nusrat S, Alam MJ, Kobourov S. 2018. “Evaluating Cartogram Effectiveness.” IEEE Trans Vis Comput Graph. https://doi.org/10.1109/TVCG.2016.2642109.

Olson, J. M. 1976. “Noncontiguous Area Cartograms.” The Professional Geographer.

Ooms, Jeroen. 2014. “The Jsonlite Package: A Practical and Consistent Mapping Between Json Data and R Objects.” arXiv:1403.2805 [stat.CO]. http://arxiv.org/abs/1403.2805.

———. 2018. Rsvg: Render Svg Images into Pdf, Png, Postscript, or Bitmap Arrays. https://CRAN.R-project.org/package=rsvg.

———. 2019. Magick: Advanced Graphics and Image-Processing in R. https://github.com/ropensci/magick#readme.

Pebesma, Edzer. 2018. Sf: Simple Features for R. https://CRAN.R-project.org/package=sf.

Pebesma, Edzer J., and Roger S. Bivand. 2005. “Classes and Methods for Spatial Data in R.” R News 5 (2): 9–13. https://CRAN.R-project.org/doc/Rnews/.

Pedersen, Thomas Lin. 2016. Ggraph: An Implementation of Grammar of Graphics for Graphs and Networks.

———. 2019. Ggforce: Accelerating ’Ggplot2’. https://CRAN.R-project.org/package=ggforce.

PROJ contributors. 2018. PROJ Coordinate Transformation Software Library. Open Source Geospatial Foundation. https://proj4.org/.

R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

Richard A. Becker, Ming-Jen Shyu, William S. Cleveland. 1996. “The Visual Design and Control of Trellis Display.” Journal of Computational and Graphical Statistics 5 (2): 123–55. http://www.jstor.org/stable/1390777.

Robin Lovelace, Jannes Muenchow, Jakub Nowosad. 2019. Geocomputation with R. Chapman and Hall/CRC.

Robinson, David. 2016. Broom: Convert Statistical Analysis Objects into Tidy Data Frames. https://CRAN.R-project.org/package=broom.

RStudio. 2014a. “Build Custom Input Objects.” Blog. https://shiny.rstudio.com/articles/building-inputs.html.

———. 2014b. “Profvis — Interactive Visualizations for Profiling R Code.” Blog. https://rstudio.github.io/profvis/examples.html.

Rudis, Bob. 2016. Ggalt: Extra Coordinate Systems, Geoms and Statistical Transformations for ’Ggplot2’. https://CRAN.R-project.org/package=ggalt.

Ruiz, Edgar. 2018. Dbplot: Simplifies Plotting Data Inside Databases. https://CRAN.R-project.org/package=dbplot.

Ryan, Jeffrey A. 2016. Quantmod: Quantitative Financial Modelling Framework. https://CRAN.R-project.org/package=quantmod.

Sarkar, Deepayan. 2008. Lattice: Multivariate Data Visualization with R. New York: Springer. http://lmdvr.r-forge.r-project.org.

Schloerke, Barret, Jason Crowley, Di Cook, Francois Briatte, Moritz Marbach, Edwin Thoen, Amos Elberg, and Joseph Larmarange. 2016. GGally: Extension to ’Ggplot2’.

Scott, David W. 1979. “On Optimal and Data-Based Histograms.” Biometrika 66: 605–10.

Scott, David W. 1992. Multivariate Density Estimation: Theory, Practice, and Visualization. Wiley & Sons.

Shneiderman, Ben. 1996. “The Eyes Have It:A Task by Data Type Taxonomy for Information Visualizations.” VL Proceedings of the IEEE Symposium on Visual Languages, January, 1–9.

Sievert, Carson. 2018a. Bcviz: A Shiny App for Exploring Bc Housing and Census Data. https://github.com/cpsievert/bcviz.

———. 2018b. “Learning from and Improving Upon Ggplotly Conversions.” Blog. https://blog.cpsievert.me/2018/01/30/learning-improving-ggplotly-geom-sf/.

———. 2018c. “Visualizing Geo-Spatial Data with Sf and Plotly.” Blog. https://blog.cpsievert.me/2018/03/30/visualizing-geo-spatial-data-with-sf-and-plotly/.

———. 2018d. Zikar: Tools for Exploring Publicly Available Zika Data. https://github.com/cpsievert/zikar.

———. 2019a. Pedestrians: Tools for Exploring Melbourne’s Pedestrian Data. https://github.com/cpsievert/pedestrians.

———. 2019b. Runpkg: Tools for Working with ’Unpkg’. https://github.com/cpsievert/runpkg.

South, Andy. 2017. Rnaturalearth: World Map Data from Natural Earth. https://CRAN.R-project.org/package=rnaturalearth.

Sturges, Herbert A. 1926. “The Choice of a Class Interval.” Journal of the American Statistical Association 21 (153): 65–66. https://doi.org/10.1080/01621459.1926.10502161.

Swayne, Deborah F, Dianne Cook, and Andreas Buja. 1998. “XGobi: Interactive Dynamic Data Visualization in the X Window System.” Journal of Computational and Graphical Statistics 7 (1): 113–30.

Theus, Martin, and Simon Urbanek. 2008. Interactive Graphics for Data Analysis: Principles and Examples. Chapman; Hall / CRC.

Tidyverse team. 2018. Tidyverse Desing Principles. https://principles.tidyverse.org.

Tierney, Nicholas, Di Cook, Miles McBain, and Colin Fay. 2018. Naniar: Data Structures, Summaries, and Visualisations for Missing Data. https://github.com/njtierney/naniar.

Tufte, Edward. 2001a. The Visual Display of Quantitative Information. Graphics Press.

———. 2001b. The Visual Display of Quantitative Information. Cheshire, Conn: Graphics Press.

Tukey, J. W., and P. A. Tukey. 1985. “Computer Graphics and Exploratory Data Analysis: An Introduction.” In In Proceedings of the Sixth Annual Conference and Exposition: Computer Graphics85.

Tyner, Samantha, and Heike Hofmann. 2016. Geomnet: Network Visualization in the ’Ggplot2’ Framework. https://CRAN.R-project.org/package=geomnet.

Unwin, Antony. 2015. Graphical Data Analysis with R. CRC Press. http://www.gradaanwr.net.

Unwin, A. R. 2016. “GDA of England (from Engsoccerdata).” Blog. http://www.gradaanwr.net/wp-content/uploads/2016/06/dataApr16.pdf.

Unwin, A. R., and H. Hofmann. 1999. “GUI and Command-Line — Conflict or Synergy?” In Computing Science and Statistics, Proceedings of the 31st Symposium on the Interface, edited by K. Berk and M. Pourahmadi, 31:246–53. Chicago: Interface Foundation.

Urbanek, Simon. 2013. Png: Read and Write Png Images. https://CRAN.R-project.org/package=png.

———. 2015. Base64enc: Tools for Base64 Encoding. https://CRAN.R-project.org/package=base64enc.

Vaidyanathan, Ramnath, Yihui Xie, JJ Allaire, Joe Cheng, and Kenton Russell. 2016. Htmlwidgets: HTML Widgets for R. https://CRAN.R-project.org/package=htmlwidgets.

VanderPlas, Susan, and Heike Hofmann. 2015. “Signs of the Sine Illusion—Why We Need to Care.” Journal of Computational and Graphical Statistics 24 (4): 1170–90. https://doi.org/10.1080/10618600.2014.951547.

Venables, W. N., and B. D. Ripley. 2002. Modern Applied Statistics with S. Fourth. New York: Springer. http://www.stats.ox.ac.uk/pub/MASS4.

Walker, Kyle. 2018. Idbr: R Interface to the Us Census Bureau International Data Base Api. https://CRAN.R-project.org/package=idbr.

Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.

———. 2010. “A Layered Grammar of Graphics.” Journal of Computational and Graphical Statistics 19 (1): 3–28.

———. 2013. “Bin-Summarise-Smooth: A Framework for Visualising Large Data.” had.co.nz.

———. 2014a. Advanced R. Chapman; Hall/CRC.

———. 2014b. “Tidy Data.” The Journal of Statistical Software 59 (10). http://www.jstatsoft.org/v59/i10/.

———. 2016. Ggstat: Statistical Computations for Visualisation. https://github.com/hadley/ggstat.

———. 2018a. Nycflights13: Flights That Departed Nyc in 2013. https://CRAN.R-project.org/package=nycflights13.

———. 2018b. “You Can’t Do Data Science in a Gui.” https://www.youtube.com/watch?v=cpbtcsGE0OA.

Wickham, Hadley, Dianne Cook, and Heike Hofmann. 2015. “Visualizing Statistical Models: Removing the Blindfold.” Statistical Analysis and Data Mining: The ASA Data Science Journal 8 (4): 203–25.

Wickham, Hadley, Romain François, and Lucy D’Agostino McGowan. 2018. Emo: Easily Insert ’Emoji’. https://github.com/hadley/emo.

Wickham, Hadley, and Garrett Grolemund. 2018. R for Data Science. O’Reilly.

Wilke, Claus. 2018. Fundamentals of Data Visualization. O’Reilly. https://serialmentor.com/dataviz/.

Wilkinson, Leland. 2005. The Grammar of Graphics (Statistics and Computing). Secaucus, NJ, USA: Springer-Verlag New York, Inc.

Wilkinson, Leland, Anushka Anand, and Robert Grossman. 2005. “Graph-Theoretic Scagnostics.” In Proceedings of the Proceedings of the 2005 Ieee Symposium on Information Visualization, 21. INFOVIS ’05. Washington, DC, USA: IEEE Computer Society. https://doi.org/10.1109/INFOVIS.2005.14.

Wilkinson, Leland, and Graham Wills. 2008. “Scagnostics Distributions.” Journal of Computational and Graphical Statistics 17 (2): 473–91.

Wills, Graham. 2008. “Linked Data Views.” In Handbook of Data Visualization, 217–41. Berlin, Heidelberg: Springer Berlin Heidelberg. https://doi.org/10.1007/978-3-540-33037-0_10.

Xie, Yihui. 2016. Servr: A Simple Http Server to Serve Static Files or Dynamic Documents. https://CRAN.R-project.org/package=servr.

———. 2018. Using Leaflet with Shiny. Blog. https://rstudio.github.io/DT/shiny.html.

Yau, Nathan. 2011. Visualize This: The FlowingData Guide to Design, Visualization, and Statistics. Wiley.

———. 2016. What I Use to Visualize Data. https://flowingdata.com/2016/03/08/what-i-use-to-visualize-data/.


Chambers, J. M. 1992. “Classes and Methods: Object-Oriented Programming in S.” In Statistical Models in S, edited by J. M. Chambers and T. J. Hastie. Wadsworth & Brooks/Cole.

Hamilton, Nicholas. 2016. Ggtern: An Extension to ’Ggplot2’, for the Creation of Ternary Diagrams. https://CRAN.R-project.org/package=ggtern.

Jeppson, Haley, Heike Hofmann, and Di Cook. 2016. Ggmosaic: Mosaic Plots in the ’Ggplot2’ Framework. http://github.com/haleyjeppson/ggmosaic.

Pedersen, Thomas Lin. 2016. Ggraph: An Implementation of Grammar of Graphics for Graphs and Networks.

Rudis, Bob. 2016. Ggalt: Extra Coordinate Systems, Geoms and Statistical Transformations for ’Ggplot2’. https://CRAN.R-project.org/package=ggalt.

Tyner, Samantha, and Heike Hofmann. 2016. Geomnet: Network Visualization in the ’Ggplot2’ Framework. https://CRAN.R-project.org/package=geomnet.

  1. There are many other useful extension packages that are listed on this website – https://www.ggplot2-exts.org↩︎

  2. For those new to S3, http://adv-r.had.co.nz/S3.html provides an approachable introduction and overview (Wickham 2014a).↩︎