Arrange plots in a circular layout by aligning discrete axis
Source:R/layout-circle-.R
circle_discrete.Rd
Arguments
- data
Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout,
fortify_matrix()
will be used to convert data to a matrix.- ...
Additional arguments passed to
fortify_matrix()
.- radial
A
coord_radial()
object that defines the global parameters forcoord_radial
across all plots in the layout. The parametersstart
,end
,direction
, andexpand
will be inherited and applied uniformly to all plots within the layout. The parameterstheta
andr.axis.inside
will always be ignored and will be set to"x"
andTRUE
, respectively, for all plots.- direction
A single string of
"inward"
or"outward"
, indicating the direction in which the plot is added.outward
: The plot is added from the inner to the outer.inward
: The plot is added from the outer to the inner.
- theme
A
theme()
object used to customize various elements of the layout, includingguides
,title
,subtitle
,caption
,margins
,panel.border
, andbackground
. By default, the theme will inherit from the parentlayout
. It also controls the panel spacing for all plots in the layout.
Examples
set.seed(123)
small_mat <- matrix(rnorm(56), nrow = 7)
rownames(small_mat) <- paste0("row", seq_len(nrow(small_mat)))
colnames(small_mat) <- paste0("column", seq_len(ncol(small_mat)))
# direction outward
circle_discrete(small_mat) +
align_dendro(aes(color = branch), k = 3L) +
scale_color_brewer(palette = "Dark2") +
ggalign() +
geom_tile(aes(y = .column_index, fill = value)) +
scale_fill_viridis_c()
# direction inward
circle_discrete(small_mat, direction = "inward") +
ggalign() +
geom_tile(aes(y = .column_index, fill = value)) +
scale_fill_viridis_c() +
align_dendro(aes(color = branch), k = 3L) +
scale_color_brewer(palette = "Dark2")