Skip to content

ggplotly() bar chart render issue #901

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
kporkka opened this issue Mar 13, 2017 · 0 comments
Open

ggplotly() bar chart render issue #901

kporkka opened this issue Mar 13, 2017 · 0 comments

Comments

@kporkka
Copy link

kporkka commented Mar 13, 2017

ggplotly() renders a layered bar chart incorrectly; results in stacked bars, see the figures. Any way to remedy? Thanks, Kimmo

data_before = data.frame(
       year = c(2014,2014,2014,2015,2015,2015,2016,2016,2016),
       pet = c("dog","cat","bird","dog","cat","bird","dog","cat","bird"),
       wt = c(56, 25, 26, 10, 19, 41, 16, 17, 13)
  )

data_after = data.frame(
  year = c(2014,2014,2014,2015,2015,2015,2016,2016,2016),
  pet = c("dog","cat","bird","dog","cat","bird","dog","cat","bird"),
  wt = c(49, 18, 19,  3, 12, 34,  9, 10,  6)
)

ggplot()+
  geom_bar(data=data_before,aes(year,wt,fill=pet),stat="identity",position="dodge",width = 0.9,alpha=0.5)+
  geom_bar(data=data_after,aes(year,wt,fill=pet),stat="identity",position="dodge",width = 0.9)+
  xlab("Year") +
  ylab("Weight")

ggplotly()

ggplot chart (correct):
rplot

ggplotly() render (incorrect)
ggplotly

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