Skip to content

Needle plots #3627

Closed
Closed
@ggrothendieck

Description

@ggrothendieck

It seems there is no nice way to create needle plots in ggplot2 whereas it is very easy in classic graphics. geom_linerange can work but seems too involved and non-obvious. A geom_needle wrapper around geom_linerange would be nice.

x <- 1:6
y <- x * c(1, -1)

plot(y ~ x, type = "h")

ggplot(data.frame(x, y), aes(x = x, ymax=pmax(0, y), ymin = pmin(0, y))) + 
  geom_linerange()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions