Skip to content

y-axis values assigned a value of zero when using geom_errorbar() #454

@royr2

Description

@royr2

For some reason, when using ggplotly() the y-axis values for the second trace are all zero.

library(plotly)
library(dplyr)

df <- diamonds[sample(1:nrow(diamonds), size = 1000),]

df.summ <- df %>% 
  group_by(cut) %>% 
  summarize(Mean = mean(table),
            Min = min(table),
            Max = max(table))

p <- ggplot(df.summ, aes(x = cut, y = Mean, ymin = Min, ymax = Max)) + 
  geom_bar(stat = "identity") +
  geom_errorbar()
print(p)

p <- plotly_build(p)
print(p)
p$data[[2]]$y

This works fine

ggplot(df.summ, aes(x = cut, y = Mean, ymin = Min, ymax = Max)) + 
  geom_point(size = 10) +
  geom_errorbar()

ggplotly()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions