plotly / plotly/plotly.R

ggplotly not keeping different line types from geom_errorbar

Open
#2,104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Thanks for a great package but I noticed one issue:

I have a ggplot which uses geom_errorbar() with a dashed line type. ggplotly removes this line type though. Is there a workaround?

Versions:

> packageVersion("plotly")
[1] ‘4.10.0’
> packageVersion("ggplot2")
[1] ‘3.3.5’

r version: 4.1.1
console: Mac

Issue replicated:

library(ggplot2)
df <- data.frame(
    trt = factor(c(1, 1, 2, 2)),
    resp = c(1, 5, 3, 4),
    group = factor(c(1, 2, 1, 2)),
    upper = c(1.1, 5.3, 3.3, 4.2),
    lower = c(0.8, 4.6, 2.4, 3.6)
)
p <- ggplot(df, aes(trt, resp, colour = group))
q<- p + geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2,linetype="dashed")
q
plotly::ggplotly(q)

tagging others: @emiliecottard

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 with the supplied R reproduction using ggplot2::geom_errorbar() and plotly::ggplotly(), then inspect how the ggplotly conversion handles the geom_errorbar linetype aesthetic. Compare the rendered output with the original dashed error bars; the issue is done when dashed line types are preserved in the converted plot.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.