Visualize Data on Spirals
Features
The package spiralize visualizes data along an Archimedean spiral. It has two major advantages for visualization:
- It is able to visualize data with very long axis with high resolution.
- It is efficient for time series data to reveal periodic patterns.
Citation
Zuguang Gu, et al., spiralize: an R package for Visualizing Data on Spirals, Bioinformatics, 2021. https://doi.org/10.1093/bioinformatics/btab778
Install
The package is available on CRAN and can be installed by:
install.packages("spiralize")
If you want the latest version, install it directly from GitHub:
library(devtools)
install_github("jokergoo/spiralize")
Usage
It includes three steps:
- initialize the spiral,
- add a track,
- add graphics in the track.
Step 2 and 3 can be applied multiple times to allow multiple-track visualization along the spiral.
The code for making spiral plot looks like follows:
library(spiralize)
spiral_initialize(...)
spiral_track(...)
spiral_points(...)
...
Graphics
Complex plots are baiscally constructed from simple graphics. Here there are following low-level graphics functions:
spiral_points()
spiral_lines()
spiral_rect()
spiral_segments()
spiral_polygon()
spiral_bars()
spiral_text()
spiral_axis()
spiral_yaxis()
spiral_raster()
Particularlly, horizon chart is very suitable to put on the spiral, thus there is one function for this:
spiral_horizon()
Spiral plot can also visualize dendrograms with large number of leaves, thus there are following two functions:
spiral_dendrogram()
spiral_phylo()
Vignettes
There are the following vignettes:
- Visualize Data on Spirals. It gives an detailed introduction of the spiralize package.
- Initialize Spirals by Special Data Types. It introduces how to specifically create spiral plot with time series data and genomic data.
- Annotate the Plot. It introduces how to add annotations and how to add legends to the plot.
- Real World Examples. It contains many examples with real world datasets.
- Visualize tree of life of 50455 species.
Examples
- Difference of ggplot2 daily downloads to the mean of the current year (2015-2021). Each loop contains 52 weeks so that same weeks in different years locate at the same angle in the polar coordinates.
- The same data as the first one, but horizon chart is used. Also title and legends are added.
- A phylogenetic life tree with 50645 species.
- The spiral COVID-19 Shiny app
https://jokergoooo.shinyapps.io/covid19/
License
MIT @ Zuguang Gu