geom_roundrect: A 'ggplot2' geom to draw genomic ranges as round rectangles.

View source: R/geom_roundrect.R

geom_roundrectR Documentation

A 'ggplot2' geom to draw genomic ranges as round rectangles.

Description

'geom_roundrect()' draws ranges defined by 'xmin' and 'xmax' coordinates with rounded edges.

Usage

geom_roundrect(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  rect_height = grid::unit(3, "mm"),
  radius = grid::unit(1, "mm"),
  ...
)

Arguments

mapping, data, stat, position, na.rm, show.legend, inherit.aes, ...

As is standard for ggplot2.

rect_height

A 'grid::unit()' object providing the height of the rectangle. (Default : '3'mm).

radius

A 'grid::unit()' object providing required curvature of rectangle edges. (Default : '1'mm).

Details

This geom draws rectangle with round or sharp edges between defined start and end coordinates. Intended application of this geom is to visualize genomic coordinates defined by start and end position. Rounded edges will help to observe boundaries between closely positioned genomic ranges.

Value

Plotting coordinates

Aesthetics

'geom_roundrect()' require or can take the following aesthetics (required aesthetics are in bold):

- **xmin** - **xmax** - **y** - color - linewidth - linetype - alpha - fill - size

Author(s)

David Porubsky

Examples

## Create example data.frame to plot
plt.df <- data.frame(
    xmin = c(10, 100, 200),
    xmax = c(100, 190, 400)
)
## Plot rectangles with rounded edges
ggplot2::ggplot(plt.df) +
    geom_roundrect(ggplot2::aes(xmin = xmin, xmax = xmax, y = 1))
## Plot rectangles without rounded edges
ggplot2::ggplot(plt.df) +
    geom_roundrect(ggplot2::aes(xmin = xmin, xmax = xmax, y = 1), radius = grid::unit(0, "mm"))


daewoooo/SVbyEye documentation built on Oct. 15, 2024, 6:12 a.m.