Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Easy plotting of periodic data with ggplot2

NotificationsYou must be signed in to change notification settings

eliocamp/ggperiodic

Repository files navigation

Travis build statusCoverage statusCRAN_Status_Badge

ggperiodic is an attempt to solve the issue of plotting periodic data inggplot2. It automatically augments your data to wrap it around to anyarbitrary domain.

Installation

You can install the latest version from CRAN with

install.packages("ggperiodic")

Or you can install the development version fromGitHub 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/180y<- seq(-90,90,by=10)*pi/180Z<- 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/piZ$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 doesthe rest.

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

About

Easy plotting of periodic data with ggplot2

Topics

Resources

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp