ggperiodic v1.0.0

0

Monthly downloads

0th

Percentile

Easy Plotting of Periodic Data with 'ggplot2'

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

Readme

ggperiodic

Travis build
status Coverage
status 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.

Installation

You can install the latest version from CRAN with

install.packages("ggperiodic")

Or you can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("eliocamp/ggperiodic")

Example

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) + 
               0.2*sin(4*x)*0.45*cos(2*x))

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

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

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

library(ggperiodic)
#> 
#> 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)) +
  coord_polar()

Functions in ggperiodic

Name Description
unperiodic Remove periodic specifications
qwrap Quickly wrap data
wrap Wrap periodic data to an arbitrary range
reexports Objects exported from other packages
is.periodic Check if an object is periodic
periodic Add or remove periodic variables
get_period Get period information from an object
ggperiodic ggperiodic: Easy Plotting of Periodic Data with 'ggplot2'
No Results!

Vignettes of ggperiodic

Name
wraping-around-ggplot2.Rmd
No Results!

Last month downloads

Details

Date 2019-03-12
License GPL-3
URL https://github.com/eliocamp/ggperiodic
BugReports https://github.com/eliocamp/ggperiodic/issues
VignetteBuilder knitr
ByteCompile true
Encoding UTF-8
LazyData true
RoxygenNote 6.1.1
NeedsCompilation no
Packaged 2019-03-12 19:16:31 UTC; elio
Repository CRAN
Date/Publication 2019-03-12 20:02:50 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/ggperiodic)](http://www.rdocumentation.org/packages/ggperiodic)