ggcirclize extends the grammar of graphics to circular visualisation. Every
layer you already know from ggplot2 — points, lines, bars, tiles, ribbons,
violins, boxplots — has a circular counterpart, and on top of that it ships a
complete set of genomic track layers (chr / gstart / gend), chord diagrams
and nested zooming. You keep writing ggplot2 code; the circle is just another
coordinate system.
If you have ever needed a circos-style figure and did not want to learn a second, low-level plotting engine, this package is for you.
| Grammar, not a new API | ggcirclize(data, aes(...)) + geom_arcpoint() — the same mapping, stats and + composition you use in ggplot2. |
| Two track families | geom_arc*() draws on the full circle, geom_track*() draws inside a radial band you position with r0 / r1. |
| Genomic layers | geom_trackgenomic*() maps chromosomes to sectors with chrom_data, so chr, gstart, gend are all you need. |
| Chord diagrams | geom_chordDiagram() turns a from/to/value data frame into a link diagram. |
| Nested zooming | geom_genomicNestedZoom() spotlights a genomic region inside the same circle instead of a second panel. |
| Circular facets | facet_sector() splits the circle into independent sectors, each with its own scales. |
| Low-level grobs | arcSectorGrob(), arcAxisGrob(), arcTextGrob() … are exported, so you can build your own layers. |
You can install the development version of ggcirclize like so:
# install.packages("devtools")
devtools::install_github("junjunlab/ggcirclize")
# or
remotes::install_github("junjunlab/ggcirclize")ggcirclize needs R ≥ 4.1 and ggplot2 ≥ 3.4. The heavy lifting on the geometry
side is done by circlize and
ComplexHeatmap, which are installed
automatically.
The reference manual is built with Sphinx and hosted on Read the Docs:
- English site: https://ggcirclize.readthedocs.io/
The old bookdown manual (https://junjunlab.github.io/ggcirclize-manual/) is kept for the 0.0.2 release and will no longer be updated.
library(ggcirclize)
library(ggplot2)
# 1. A plain circular scatter: x maps to the angle, y to the radius
ggcirclize(data = mtcars, mapping = aes(x = mpg, y = disp, end = 360)) +
geom_arcpoint()# 2. Several tracks on one circle
set.seed(1)
df <- data.frame(
x = rep(1:24, 2),
y = c(runif(24, 2, 6), runif(24, 3, 8)),
gp = rep(c("A", "B"), each = 24)
)
ggcirclize(df, aes(x = x, y = y, gp = gp, end = 360)) +
geom_arcline() +
geom_arcpoint(size = 1.5)# 3. Genomic data: chromosomes become sectors
data("hg19_chrom_info", package = "ggcirclize")
chrom_hg19 <- hg19_chrom_info$chromsize
bed <- circlize::generateRandomBed(nr = 200)
ggcirclize(bed, aes(end = 360, chr = chr, gstart = start, gend = end, value = value1)) +
geom_trackgenomicpoint(chrom_data = chrom_hg19)Nearly every ggplot2 layer has a circular counterpart here. Arc layers draw
on the circle itself; track layers draw the same thing inside a radial band
that you place with r0 / r1.
ggplot2 |
Arc layer (full circle) | Track layer (radial band) |
|---|---|---|
geom_point() |
geom_arcpoint() |
geom_trackpoint() |
geom_line() |
geom_arcline() |
geom_trackline() |
geom_path() |
geom_arcpath() |
— |
geom_segment() |
geom_arcsegment() |
— |
geom_bar() (count) |
geom_arcbar() |
geom_trackbar() |
geom_col() (identity) |
geom_arccol() |
geom_trackcol() |
geom_histogram() |
geom_archistogram() |
geom_trackhist() |
geom_rect() |
geom_arcrect() |
geom_trackrect() |
geom_tile() |
geom_arctile() |
geom_tracktile() / geom_tracktile2() |
geom_area() |
geom_arcarea() |
geom_trackarea() |
geom_ribbon() |
geom_arcribbon() |
geom_trackribbon() |
geom_violin() |
geom_arcviolin() |
geom_trackviolin() |
geom_boxplot() |
geom_arcboxplot() |
geom_trackboxplot() |
geom_crossbar() |
geom_arcrossbar() |
— |
geom_density() |
geom_arcdensity() |
geom_trackdensity() |
geom_linerange() |
geom_arclinerange() |
— |
geom_polygon() |
geom_arcpolygon() |
— |
geom_text() |
geom_arctext() |
— |
geom_rect() (sector) |
geom_arcsector() |
geom_tracksector() |
geom_curve() (arrow) |
geom_arcarrow() |
— |
Genomic track layers — take chr / gstart / gend and turn chromosomes into
sectors through chrom_data:
| Layer | What it draws |
|---|---|
geom_trackgenomicpoint() |
points at genomic positions |
geom_trackgenomicline() |
a line joining genomic positions |
geom_trackgenomicarea() |
filled area under the values |
geom_trackgenomicrect() |
rectangles spanning gstart–gend |
geom_trackgenomictile() |
a tile per genomic interval |
geom_trackgenomictile2() |
tile variant with per-chromosome fill |
geom_trackgenomicdensity() |
density along the chromosome |
geom_trackgenomicrainfall() |
rainfall-style depth plot |
geom_trackgenomiclink() |
links between two genomic regions |
geom_trackgenomiclabel() |
gene labels with leader lines |
geom_trackgenomiclabel2() |
labels placed by smart alignment |
Also available
| Function | Purpose |
|---|---|
geom_chordDiagram() |
chord / link diagram from a from/to/value table |
geom_genomicNestedZoom() |
nested zoom of a genomic region inside the same circle |
facet_sector() |
split the circle into independent sectors with their own scales |
geom_cpoint() |
plain scatter points, for mixing with the arc layers |
Low-level grobs — exported, so you can compose your own layers:
| Grob | Draws |
|---|---|
arcSectorGrob() |
a sector (the arc equivalent of a rectangle) |
arcRectGrob() |
a rectangle in polar space |
arcPointGrob() |
points |
arcLinesGrob() |
a polyline |
arcSegmentsGrob() |
straight segments between two angles |
arcPolygonGrob() |
a closed polygon |
arcArrowGrob() |
an arrow between two angles |
arcTextGrob() |
text with circlize-compatible facing |
arcAxisGrob() |
a circular axis with ticks and labels |
arcLinksGrob() |
links between two sets of angles |
arcLinks2Grob() |
links with a mid-point offset |
Jun Zhang (2023). Creating Circular Graph with the Grammar of GGplot2. https://github.com/junjunlab/ggcirclize
- 2026/10/29 (Documentation moved to Sphinx + Read the Docs, replacing the old bookdown manual.)
- 2026/10/29 (Fixing the package being completely unusable under ggplot2 4.x:
...forwarding, lostmappingclass, andexpandsemantics.) - 2026/10/29 (Restoring StatArcbar / StatArcboxplot / StatArcdensity that were dropped in 0.0.2, so
geom_arcbar(),geom_trackbar(),geom_trackboxplot()andgeom_trackdensity()no longer error out on call.) - 2026/10/29 (geom_trackgenomiclabel / geom_trackgenomiclabel2 label placement and link segments reworked to match the manual examples; outer chr labels now all follow the arc.)
- 2026/10/29 (Text and axes aligned with circlize: unified
arc_theta()angle mapping, fullfacingsemantics, and a rewritten arcAxisGrob.) - 2026/10/29 (Added
tests/smoke.Rregression suite covering 60+ layers, grobs and utility functions.)
- 2023/12/08 (Adding geom_genomicNestedZoom layer to visualize zoomed plot regions.)
- 2023/12/06 (Adding geom_tracktile2 and geom_trackgenomictile2 layers.)
- 2023/12/02 (Adding geom_chordDiagram layer.)
- 2023/11/29 (Adding geom_trackgenomiclabel2 layer.)
- 2023/11/26 (First version pushed.)
- ggcirclize 绘制基因组数据初探
- Nested Zooming: 嵌套放大
- 环形分面布局探索
- arcpolygon 画掰弯的图形
- 从 grid 到 ggplot 的跃迁
- 环形坐标轴研究
- 圈圈补充
- 画一些圈圈
ggcirclize would not exist without circlize
and ComplexHeatmap by Zuguang Gu —
they provide the arc geometry, the axis machinery and the genomic coordinate
handling that this package wraps in a ggplot2 interface. Thanks also to the
ggplot2 team for a grammar that turned out to bend quite well.
- Browse the reference manual — every layer has a runnable example.
- Found a bug or have a question? Open an issue.
- Pull requests are welcome;
tests/smoke.Rruns the rendering regression suite.
MIT © Jun Zhang. See LICENSE.md for details.