R geom_tile 宽度和高度在 ggplotly 中被忽略
高度
和width
geom_tile
的参数在转换为ggplotly
时,不会考虑考虑下面的示例。有工作吗?请注意,我的数据集实际上很大(+80k数据点),因此,如果有一个,我会赞成有效的解决方案。
library(plotly)
X <- data.frame(x = c(1, 2, 1, 2), y = c(1, 1, 2, 2), z = 1:4)
gg <- ggplot(X, aes(x, y)) + geom_tile(aes(fill = z), width = .5, height = .5)
gg
ggplotly(gg)
The height
and width
parameters of geom_tile
are not being taken into account when converted to ggplotly
, as shown in the example below. Is there a work around? Please note that my dataset is in fact very large (+80k data points), so I would favor an efficient solution, if there is one.
library(plotly)
X <- data.frame(x = c(1, 2, 1, 2), y = c(1, 1, 2, 2), z = 1:4)
gg <- ggplot(X, aes(x, y)) + geom_tile(aes(fill = z), width = .5, height = .5)
gg
ggplotly(gg)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是 ggplotly 中的一个错误。最简单的方法是将
geom_tile
转换为geom_rect
。我认为这不会比geom_tile
效率低,因为您只是复制geom_tile
内部所做的事情。This seems to be a bug in ggplotly. The easiest thing would be to convert your
geom_tile
togeom_rect
. I don't think this will be any less efficient thangeom_tile
, since you are just replicating whatgeom_tile
does internally.