I use the geom_bar chart in ggplotly and it makes negative positive bars. Any ideas why this might be the case, and in particular how to solve it?
library(ggplot2)
library(plotly)
dat1 <- data.frame(
sex = factor(c("Female","Female","Male","Male")),
time = factor(c("Lunch","Dinner","Lunch","Dinner"), levels=c("Lunch","Dinner")),
total_bill = c(-13.53, 16.81, 16.24, 17.42)
)
g <- ggplot(data=dat1, aes(x=time, y=total_bill, fill=sex)) +
geom_bar(stat="identity", position=position_dodge())
ggplotly(g)
Why will the first bar be in a positive direction with a negative value?
The versions I use are the latest:
plotly_3.4.13
ggplot2_2.1.0
source
share