Learn R Programming

BioVizSeq (version 1.0.3)

geom_rrect: geom_rrect

Description

Rounded rectangle

Usage

geom_rrect(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  r = 0.2,
  ...,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)

Value

ggplot object

Arguments

mapping

Set of aesthetic mappings created by aes. If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame.

stat

Name of stat to modify data.

position

The position adjustment to use for overlapping points on this layer.

r

The radius of rounded corners.

...

additional parameter, e.g. color, linewidth, alpha.

na.rm

If "FALSE" (default), missing values are removed with a warning. If "TRUE", missing values are silently removed, logical.

show.legend

Whether to show legend, logical.

inherit.aes

Whether to inherit aesthetic mappings, logical, defaults to "TRUE".

Aesthetics

geom_rrect() understands the following aesthetics (required aesthetics are in bold):

Learn more about setting these aesthetics in vignette("ggplot2-specs").

Author

Shiqi Zhao

Details

draws rounded rectangle by using the locations of the four corners (xmin, xmax, ymin and ymax) like geom_rect().

Examples

Run this code
library(ggplot2)
df <- data.frame(
 xmin = c(1, 2, 3),
 xmax = c(2, 3, 4),
 ymin = c(1, 2, 3),
 ymax = c(2, 3, 4),
 category = c("A", "B", "C")
 )
 
 p <- ggplot(df) +
   geom_rrect(aes(xmin = xmin, xmax = xmax, 
              ymin = ymin, ymax = ymax, fill = category), 
             r = 0.4, linewidth = 1, colour = "black") 
 
 print(p)

Run the code above in your browser using DataLab