http://community.plot.ly/t/inversion-negative-values-in-ggplotly/875
d <- data.frame(
x = LETTERS[1:10],
y = -5:4,
g = rep(c('A','B'), each = 5)
)
p <- ggplot(data = d, aes(x = x, y = y, fill = g)) +
geom_bar(stat='identity')
ggplotly(p)
Any clues here? Happy to work on this. I tracked to here, and everything looks fine.
This is the source of the problem (that subtraction is essentially assuming positive ymin/ymax values)
We'll probably need to switch from barmode='stacked' to 'relative' to fix this issue -- https://github.com/plotly/plotly.js/pull/517
Just in case somebody needs this before we fix, we can accomplish with plot_ly.
plot_ly(
data = d,
x = x,
y = y,
color = g,
type = "bar"
) %>%
layout(
xaxis = list(type="category", categoryorder="category ascending")
)

+1, already an idea when this one will be fixed?
Looks like I'm not the only one who has issue with this . . . Any update on the fix? Thanks!
Unfortunately @timelyportfolio 's workaround does not work for orientation = 'h'
d <- data.frame(
x = LETTERS[1:10],
y = -5:4,
g = rep(c('A','B'), each = 5)
)
plot_ly(
data = d,
x = ~y,
y = ~x,
color = ~g,
type = "bar",
orientation ='h'
) %>%
layout(
xaxis = list(type="category", categoryorder="category ascending")
)
Any updates regarding a fix for the negative bars turning positive? thank you very much
hello! i am having the same issue. curious about whether a fix may be in the works. I use this with my class!
Hello, I'm have the same problem... UP this issue
Most helpful comment
Looks like I'm not the only one who has issue with this . . . Any update on the fix? Thanks!