2 min read

ggplot2 team has announced a new version 3.0.0 with breakthrough changes. This new release brings some revolutionary changes within their library to ease advanced data visualizations and create appealing aesthetics.

ggplot2 is an open source library in R which allows you to create visual representations. It follows a process of breaking up the advanced graphs into semantic components such as scales and layers. ggplot2 has grown in use considerably within the R community thus becoming one of the popular R packages used today.

Some of the noteworthy changes in the library are:

Tidy evaluation

  • ggplot2 now supports tidy evaluation. This allows you to easily build plots in the same way you can programmatically build data manipulation pipelines with dplyr
  • Now you can use quasiquotation in aes(), facet_wrap(), and facet_grid()
  • ggplot2 is now more easily programmable and consistent with the rest of the tidyverse packages

New features added to the library

  • It supports all simple features using sf with geom_sf() and coord_sf()
  • It can automatically align CRS across layers, draw a graticule, and can set up the correct aspect ratio
  • New stat() function now offers a cleaner and better-documented syntax for calculated aesthetics variables
  • You can use syntax aes(y = stat(count)), thus replacing the old traditional approach of surrounding the variable name with (Example – aes(y = ..count..))
  • A new tag label has been added for identifying plots in addition to title, subtitle and, caption.

Layers: geoms, stats, and position adjustments

  • Now you can arrange the horizontal position of plots with variable widths for bars and rectangles in addition to box plots using the new function position_dodge2()
  • There are many other functions and new parameters added to enhanced the layers of the graphics. To know more, you can refer to the GitHub page.

Scales and guides

  • Improved support for ordered factors and mapping data/time variables to alpha, size, color, and fill aesthetics, including date_breaks and date_labels arguments
  • Several new functions have been added to make it easy to use Viridis colour scales – scale_colour_viridis_c() and scale_fill_viridis_c() for continuous, and scale_colour_viridis_d() and scale_fill_viridis_d() for discrete
  • To know more about the enhanced support, you can refer the GitHub page.

Nonstandard aesthetics

  • Improved support for nonstandard aesthetics. They can now be specified independently of the scale name.

There is a huge list of bug fixes and improvements done to the library, if you want to refer to the changes done, you can refer Minor bug fixes and improvements page.

You can find the complete list of new updates and changes done to the library along with how to handle common errors and ways to work around them in the breaking changes section of ggplot2 GitHub page.

Read next


Subscribe to the weekly Packt Hub newsletter. We'll send you this year's Skill Up Developer Skills Report.

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here