Reusing ‘ggplot2’ code: how to design better plot helper functions


Details
Combined Melbourne R User and Statistical Society of Australia-VIC Meeting!!!
Title: Reusing ‘ggplot2’ code: how to design better plot helper functions
Abstract: Wrapping ‘ggplot2’ code into plot helper functions is a common way to make multiple versions of a custom plot without copying and pasting the same code over and over again. Helper functions can replace long and complex ‘ggplot2’ code chunks with just a single function call. However, if that single function is not designed carefully, the initial convenience can often turn into frustration. While helper functions can reduce the amount of code needed to remake a complicated plot, they often mask the underlying layered grammar of graphics, complicating further customisation and tweaking of the plot. This talk addresses how to design effective ‘ggplot2’ plot helper functions that maximise reuse convenience whilst preserving access to the elegant flexibility of layered plot composition. By studying existing ‘ggplot2’ extensions for producing calendar plots, we identify a number of common pitfalls, including overly specific function arguments and hidden data manipulations. Then, propose a strategy for avoiding these pitfalls and retain the benefits of ‘ggplot2’ by: separating data preparation from plotting, utilising list arguments for customisation, and providing transparent documentation. We illustrate these strategies using examples from the design of the ‘ggtilecal’ package, which provides helper functions for plotting calendars using the geom_tile() geometry from ggplot2.
Speaker: Dr Cynthia Huang
Agenda:
6:00-6:45 - Networking over refreshments/coffee/tea/drinks
6:45-7:00 - Welcome and talk introductions
7:00-7:30 - Seminar/Talk
7:30-7:45 - Q and A
7:45-8:00 - Networking and closing
NOTE:
1. This is a live event, no facility for online/hybrid attendance. Until further notice MelbURN will only provide face-to-face meetings. However, we can use this meet up for chats, news and communication.
2. Please RSVP for catering purposes. Also, please note, if you have special dietary needs, we recommend you BYO as what will be provided will only be of standard + vegetarian options.

Sponsors
Reusing ‘ggplot2’ code: how to design better plot helper functions