画太极其实很简单,只用draw.sector()函数就可以了。
library(circlize)
## ========================================
## circlize version 0.4.4
## CRAN page: https://cran.r-project.org/package=circlize
## Github page: https://github.com/jokergoo/circlize
## Documentation: http://jokergoo.github.io/circlize_book/book/
##
## If you use it in published research, please cite:
## Gu, Z. circlize implements and enhances circular visualization
## in R. Bioinformatics 2014.
## ========================================
args(draw.sector)
## function (start.degree = 0, end.degree = 360, rou1 = 1, rou2 = NULL,
## center = c(0, 0), clock.wise = TRUE, col = NA, border = "black",
## lwd = par("lwd"), lty = par("lty"))
## NULL
draw.sector() 函数可以在画布上不受限制地绘制扇形、轨道圈。
- start.degree 开始的角度,默认是0度,也就是3点钟方向,如果设置为90度即为12点方向。
- end.degree 结束的角度。默认是360度,若起点和终点均为默认值,则从3点钟方向开始顺时针走360度返回原点。
- rou1 = 取值 [0,1]之间, 若取值为1,则代表以一个单位(unit)的值为半径绘制图形
- rou2 = 默认取值是NA, 即内侧的弧形半径为0。
- col = 填充色
- border = 边框颜色
- center = c(0,0) 圆心的位置,默认为(0,0),可以自定义,
draw.sector()之前必须用circos.initialize()函数初始化,目的是设定一个圆点并产生一个单位的半径。
circos.initialize(factors = 1, xlim = c(0,1))
circos.clear()
circos.initialize(factors = 1, xlim = c(0,1))
draw.sector(start.degree = -90, end.degree = 90, rou1 = 1 ,col = "black")
draw.sector(start.degree = 90, end.degree = -90, rou1 = 1 ,col = "white")
circos.clear()
circos.initialize(factors = 1, xlim = c(0,1))
draw.sector(start.degree = -90, end.degree = 90, rou1 = 1 ,col = "black")
draw.sector(start.degree = 90, end.degree = -90, rou1 = 1 ,col = "white")
draw.sector(center = c(0,0.5) ,col = "black" , rou1 = 0.5 ,start.degree = 90, end.degree = -90)
draw.sector(center = c(0,-0.5) ,col = "white" , rou1 = 0.5 ,start.degree = -90, end.degree = 90, border = "white")
circos.clear()
circos.initialize(factors = 1, xlim = c(0,1))
draw.sector(start.degree = -90, end.degree = 90, rou1 = 1 ,col = "black")
draw.sector(start.degree = 90, end.degree = -90, rou1 = 1 ,col = "white")
draw.sector(center = c(0,0.5) ,col = "black" , rou1 = 0.5 ,start.degree = 90, end.degree = -90)
draw.sector(center = c(0,-0.5) ,col = "white" , rou1 = 0.5 ,start.degree = -90, end.degree = 90, border = "white")
draw.sector(center = c(0,-0.5) ,col = "black" , rou1 = 0.05 ,border = "black")
draw.sector(center = c(0,0.5) ,col = "white" , rou1 = 0.05 ,border = "white")
circos.clear()
sessionInfo()
## R version 3.5.1 (2018-07-02)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 16299)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=Chinese (Simplified)_China.936
## [2] LC_CTYPE=Chinese (Simplified)_China.936
## [3] LC_MONETARY=Chinese (Simplified)_China.936
## [4] LC_NUMERIC=C
## [5] LC_TIME=Chinese (Simplified)_China.936
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] circlize_0.4.4
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.17 digest_0.6.15 rprojroot_1.3-2
## [4] grid_3.5.1 backports_1.1.2 magrittr_1.5
## [7] evaluate_0.10.1 stringi_1.1.7 GlobalOptions_0.1.0
## [10] rmarkdown_1.10 tools_3.5.1 stringr_1.3.1
## [13] yaml_2.1.19 compiler_3.5.1 colorspace_1.3-2
## [16] shape_1.4.4 htmltools_0.3.6 knitr_1.20