Skip to contents

[Experimental]

This function integrates the functionalities of circle_discrete() and circle_continuous() into a single interface.

Usage

circle_layout(data = NULL, ..., limits = waiver())

Arguments

data

Default dataset to use for the layout. If not specified, it must be supplied in each plot added to the layout:

  • If limits is not provided, fortify_matrix() will be used to get a matrix.

  • If limits is specified, fortify_data_frame() will be used to get a data frame. Note that if the data is a matrix, it will be automatically converted to a long-formatted data frame, which differs from ggplot2's behavior.

...

Additional arguments passed to fortify_data_frame().

limits

A continuous_limits() object specifying the left/lower limit and the right/upper limit of the scale. Used to align the continuous axis.

Value

A CircleLayout object.

Examples

set.seed(123)

# circle_discrete
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)))
circle_layout(small_mat) +
    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")


# circle_continuous
circle_layout(mpg, limits = continuous_limits(c(3, 5))) +
    ggalign(mapping = aes(displ, hwy, colour = class)) +
    geom_point(size = 2) +
    ggalign(mapping = aes(displ, hwy, colour = class)) +
    geom_point(size = 2) &
    scale_color_brewer(palette = "Dark2") &
    theme_bw()