我发现了一个有趣而奇怪的区别,即在ggplot和ggplotly中相同的图表显示不同。
Translated:我发现了一个有趣而奇怪的区别,即在ggplot和ggplotly中相同的图表显示不同。
income_gap_chart <- ggplot(income_gap, aes(x = Country, y = Percent, fill = Income)) +
geom_bar(position = "dodge", stat = "identity") +
scale_fill_brewer(palette = "Set1") +
coord_flip() +
theme(axis.title.y = element_blank()) +
scale_y_continuous(limits = c(0, 100)) +
theme_tufte() +
theme(axis.title.y = element_blank()) +
theme(legend.position = "bottom")
对于ggplot,底部的图例标题看起来非常完美
但是当我用ggplotly()包装它时,图例开始表现出不同的行为
我的问题是 - 我想要第一个图以ggplotly格式显示,但无法解决这个问题,并且底部的图例不起作用。 有什么想法吗?
谢谢!