【发布时间】:2020-06-22 06:57:38
【问题描述】:
当情节中有很多条时,x轴过于拥挤,是否可以在情节中添加滚动条?下面的例子很简单,只有 26 个柱,我需要绘制 100 多个柱。谢谢。
library(ggplot2)
library(plotly)
tdf <- data.frame(c = letters[1:26], v = 1:26)
p <- ggplot(tdf, aes(x = c, y = v)) +
geom_bar(stat = "identity", width = 1)
ggplotly(p, width = 200)
【问题讨论】:
-
哎呀,刚刚看到另一个问题是关于 python 的。尽管 R 中有一些类似的功能
-
这个帖子应该有帮助:community.plotly.com/t/…
-
如果你想坚持使用 ggplot ...旋转标签可能是一个解决方案。像 ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90))
-
@stefan 尝试了 rangeslider(),但不是一个很好的解决方案,起初所有的酒吧仍然挤在一起。
标签: r ggplot2 scrollbar ggplotly