Skip to content

ggplotly does not support negative values #874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mubashirqasim opened this issue Feb 7, 2017 · 4 comments
Closed

ggplotly does not support negative values #874

mubashirqasim opened this issue Feb 7, 2017 · 4 comments

Comments

@mubashirqasim
Copy link

Hi there,

I have just found that ggplotly take absolution of values before plotting. In other words it seems it does not support negative values.

p <- ggplot(dft, aes(x=id, y=value, fill=value)) + geom_bar(stat="identity") +
geom_abline(intercept = x, slope = 0, color = "blue", size = .3) +
geom_text(aes(15,x,label = "Avg. value", vjust = -1))

plot(p)
ggplotly(p)

@tjbutler
Copy link

tjbutler commented Mar 9, 2017

I believe I found the same thing. I have a histogram with different values below and above the horizontal axis. This plots correctly without plotly, with one histogram downward from the horizontal axis and one above it, but with ggplotly it overlays the two histograms on top of each other, both above the axis.

I don't know if it's helpful in determining cause, but the bars also appear to be stacked instead of overlayed.

set.seed(15)
dd<-data.frame(x=rnorm(100,5,2))
set.seed(5)
dd2<-data.frame(x=rnorm(100,5,2))
p3 <- ggplot() + geom_histogram(data=dd,aes(x=x,y=..count..)) + geom_histogram(data=dd2,aes(x=x,y=-..count..),color='green')
p3
ggplotly(p3)

orig_histogram
plotly_histogram

@maxheld83
Copy link

I, too, have this issue. I think it is a duplicate of #560

@rosseji
Copy link

rosseji commented Aug 25, 2017

Is this not closed because the fix hasn't worked properly? Still getting errors in plotly_4.7.1

screen shot 2017-08-25 at 1 23 31 pm

@cpsievert
Copy link
Collaborator

This seems to be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants