Skip to content

geom_errorbar - error bars displaying incorrectly (horizontal) #710

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

Open
tamilyn opened this issue Sep 8, 2016 · 1 comment
Open

geom_errorbar - error bars displaying incorrectly (horizontal) #710

tamilyn opened this issue Sep 8, 2016 · 1 comment

Comments

@tamilyn
Copy link

tamilyn commented Sep 8, 2016

geom_errorbar - error bars are displayed incorrectly (wrong size) on the horizontal display (does not happen for the vertical (non coord_flip() version)

Sample to reproduce:

dd2 <- data.frame( auc=c(0.268707482993197,0.571428571428571), 
                   high=c(0.407680628614317,0.648343533190079), 
                   low=c(0.129734337372078,0.494513609667063), 
                   Names = c("Firmicutes","Spirochaetes"))


library(ggplot2)
library(plotly)

gx <- ggplot(data=dd2, aes(y=auc, x=Names))  + 
  geom_bar(stat="identity") +   
  geom_errorbar(aes(ymax = high, ymin=low)) +
  coord_flip()
gx

gp <- ggplotly(gx)
gp   # error bars are incorrect size
@tamilyn
Copy link
Author

tamilyn commented Sep 9, 2016

ggplotly does not display the error bars the same as ggplot (which I am assuming is the intention), but a workaround that mostly addresses the issue is to specify some additional parameters for the ggplotly. In this case the following parameters make the error bars look reasonable

geom_errorbar(aes(ymax = high-0.5, ymin=low-0.5,width=0.03,size=.01)

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

2 participants