View source: R/geom_roundrect.R
geom_roundrect | R Documentation |
'geom_roundrect()' draws ranges defined by 'xmin' and 'xmax' coordinates with rounded edges.
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"),
...
)
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). |
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.
Plotting coordinates
'geom_roundrect()' require or can take the following aesthetics (required aesthetics are in bold):
- **xmin** - **xmax** - **y** - color - linewidth - linetype - alpha - fill - size
David Porubsky
## 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.