Skip to content

ggplotly removes error bars #1571

Open
Open
@tjmckinley

Description

@tjmckinley

Hi,

Thanks for producing this great package. I think I've found a bug that occurs when trying to get ggplotly to produce error bars. The bug occurs when you try to set a colour aesthetic, at which point ggplotly removes the error bars. A reprex is below:

library(ggplot2)
library(plotly)

## create data set
data <- data.frame(
    x = rep(paste0("G", 1:2), each = 2),
    col = rep(paste0("T", 1:2), 2),
    mn = 1:4,
    LCI = 1:4 - 0.5,
    UCI = 1:4 + 0.5
)

## ggplot version (has error bars)
p <- ggplot(data, aes(x = x, colour = col)) +
    geom_point(aes(y = mn)) +
    geom_errorbar(aes(ymin = LCI, ymax = UCI))

## plotly version (removes error bars)
ggplotly(p)

Many thanks,

TJ

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions