ggplotly and geom_bar when using dates - latest version of plotly (4.7.0)

倖福魔咒の 提交于 2019-12-03 09:11:15

This appears to be a problem in Mac and seems to be related with the way geom_bar handles dates.

I found that adding as.POSIXct() fixes the issue.

x <- c("1963-06-01", "1964-06-01", "1965-06-01","1966-06-01")
y <- c(1162.7, 975.4, 1280.3, 1380.0)
data<- data.frame(x, y)

ggplotly(ggplot(data=data) + 
  geom_bar(aes(x = as.POSIXct(x), y = y), stat = "identity"))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!