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

polar: Dots and Their Connections in Polar Coordinate System

License

NotificationsYou must be signed in to change notification settings

ShixiangWang/polar

Repository files navigation

ggpolar status badgeCRAN status

{ggpolar} provides a very flexible way to create dots in coordinatesystem for event list and connect the dots with segments based on{ggplot2}.

Installation

You can install the released version of{ggpolar} from CRAN with:

install.packages("ggpolar")

You can install the development version of{ggpolar} from GitHub with:

remotes::install_github("ShixiangWang/polar")

Example

Init a polar plot

library(ggpolar)#> Loading required package: ggplot2data<-data.frame(x=LETTERS[1:7])p1<- polar_init(data,x=x)p1

# Set aes valuep2<- polar_init(data,x=x,size=3,color="red",alpha=0.5)p2

# Set aes mappingset.seed(123L)data1<-data.frame(x=LETTERS[1:7],shape= c("r","r","r","b","b","b","b"),color= c("r","r","r","b","b","b","b"),size= abs(rnorm(7)))# Check https://ggplot2.tidyverse.org/reference/geom_point.html# for how to use both stroke and colorp3<- polar_init(data1,x=x, aes(size=size,color=color,shape=shape),alpha=0.5)p3

Connect polar dots

data2<-data.frame(x1=LETTERS[1:7],x2= c("B","C","D","E","C","A","C"),color= c("r","r","r","b","b","b","b"))p4<-p3+ polar_connect(data2,x1,x2)p4

# Unlike polar_init, mappings don't need to be included in aes()p5<-p3+ polar_connect(data2,x1,x2,color=color,alpha=0.8,linetype=2)p5

# Use two different color scalesif (requireNamespace("ggnewscale")) {  library(ggnewscale)p6=p3+    new_scale("color")+    polar_connect(data2,x1,x2,color=color,alpha=0.8,linetype=2)  print(p6+ scale_color_brewer())  print(p6+ scale_color_manual(values= c("darkgreen","magenta")))}#> Loading required namespace: ggnewscale#> Warning: package 'ggnewscale' was built under R version 4.2.1

Citation

If you use{ggpolar} in academic research, please cite the followingpaper along with the GitHub repo.

Antigen presentation and tumor immunogenicity in cancer immunotherapyresponse prediction,eLife.https://doi.org/10.7554/eLife.49020.

About

polar: Dots and Their Connections in Polar Coordinate System

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp