plotly / plotly/plotly.R

ggplotly removes error bars

Open
#1,571 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug ggplotly
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ggplotly(p) entry point and run the reprex from the issue with the colour aesthetic and geom_errorbar layers. Done means the plotly output retains the error bars when colour is mapped to col, matching the ggplot version.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.