roundsegment | R Documentation |
Round segments that end where they should.
GeomRoundseg
geom_roundseg(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
arrow = NULL,
arrow.fill = NULL,
linejoin = "round",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
## S3 method for class 'roundseg'
makeContent(x)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
arrow |
specification for arrow heads, as created by |
arrow.fill |
fill colour to use for the arrow head (if closed). |
linejoin |
Line join style (round, mitre, bevel). |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
An object of class GeomRoundseg
(inherits from GeomSegment
, Geom
, ggproto
, gg
) of length 2.
Allan Cameron
Stackoverflow thread https://stackoverflow.com/questions/77494430/how-to-draw-segment-with-round-end-that-does-not-extend-beyond-values
df <- data.frame(x = 0, xend = 1, y = 0, yend = 1)
ggplot(df, aes(x, y)) +
geom_roundseg(aes(xend = xend, yend = yend),
linewidth = 6, alpha = 0.5) +
geom_point() +
geom_point(aes(xend, yend))
ggplot(df, aes(x, y)) +
geom_vline(xintercept = c(0, 1), lty = 2) +
geom_roundseg(aes(xend = xend, yend = yend),
linewidth = 6, alpha = 0.5)
ggplot(df, aes(x, y)) +
geom_roundseg(aes(xend = xend, yend = yend),
linewidth = 1, alpha = 0.5) +
geom_point() +
geom_point(aes(xend, yend))
ggplot(df, aes(x, y)) +
geom_roundseg(aes(xend = xend, yend = yend),
linewidth = 30, alpha = 0.5) +
geom_point() +
geom_point(aes(xend, yend))
df_angle <- data.frame(x = 0, xend = 1, y = 0, yend = 1)
ggplot(df_angle, aes(x, y)) +
geom_roundseg(aes(xend = xend, yend = yend),
linewidth = 6, alpha = 0.5) +
geom_point() +
geom_point(aes(xend, yend))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.