Easy Plotting of Periodic Data with 'ggplot2'

Implements methods to plot periodic data in any arbitrary range on the fly.

Travis buildstatus Coveragestatus CRAN_Status_Badge

ggperiodic is an attempt to solve the issue of plotting periodic data in ggplot2. It automatically augments your data to wrap it around to any arbitrary domain.


You can install the development version from GitHub with:

# install.packages("devtools")


Let’s create some artificial data with periodic domain

x <- seq(0, 360 - 10, by = 10)*pi/180
y <- seq(-90, 90, by = 10)*pi/180
Z <- expand.grid(x = x, y = y)
Z$z <- with(Z, 1.2*sin(x)*0.4*sin(y*2) - 
               0.5*cos(2*x)*0.5*sin(3*y) + 
Z$x <- Z$x*180/pi
Z$y <- Z$y*180/pi

If you try to plot it, you’ll notice problems at the limits

ggplot(Z, aes(x, y, z = z, color = ..level..)) +
  geom_contour() +

With ggperiodic you can define the periodic dimensions and ggplot2 does the rest.

#> Attaching package: 'ggperiodic'
#> The following object is masked from 'package:stats':
#>     filter
Z <- periodic(Z, x = c(0, 360))
ggplot(Z, aes(x, y, color = ..level..)) +
  geom_contour(aes(z = z)) +


ggperiodic 0.1.0

  • Implemented dplyr methods.
  • Published on github
  • Added a NEWS.md file to track changes to the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.0 by Elio Campitelli, 8 days ago


Report a bug at https://github.com/eliocamp/ggperiodic/issues

Browse source code at https://github.com/cran/ggperiodic

Authors: Elio Campitelli [cre, aut]

Documentation:   PDF Manual  

GPL-3 license

Imports dplyr, ggplot2, sticky, tidyselect, data.table

Suggests covr, knitr, maps, rmarkdown, testthat, vdiffr

See at CRAN