小编Jia*_*hen的帖子

如何解决geom_segment中的箭头在plotly下无法显示

我用ggplot2画了一张图。由于定向图片,我在 geom_segment 中使用箭头选项。但是当我使用 ggplotly 在 plotly 下显示我的图片时,箭头消失了。如何显示箭头?您可以运行以下代码进行调试。

positiox_positiony <- data.frame(x_position=1:2,y_position=3:4)
node_edge_xy <- data.frame(x=1,y=3,xend=2,yend=4)
p <- ggplot(positiox_positiony,aes(x=x_position,y=y_position))+
  geom_point(color="red",size=10,alpha=0.8)+
  geom_segment(data=node_edge_xy,aes(x = x,y = y,xend = xend,yend = yend),
               arrow = arrow(length = unit(0.25,"cm"),ends="last",type="closed"))
p

ggplotly(p)
Run Code Online (Sandbox Code Playgroud)

r ggplot2 plotly

5
推荐指数
1
解决办法
598
查看次数

标签 统计

ggplot2 ×1

plotly ×1

r ×1