geom_net不会绘制网络的所有节点

时间:2018-10-15 14:27:48

标签: r networking ggplot2 nodes

我有一个带有3个变量的df,“从”-“到”-“频率”。 “ from”具有5个级别,“ to”具有22个级别。“ Frequency”表示在原始DF中发生from-to连接的次数。

当我用此信息绘制网络时,该图仅显示“ from”中的5个节点,箭头指向空白。

为什么我不能绘制所有节点,包括“到”节点? 这是ggplot的脚本:

ggplot(data=NetY, aes(from_id = from, to_id = to, linewidth =freq)) +
  geom_net(labelon=TRUE, directed = TRUE, col = "darkred",vjust=-1, arrowsize = 1, 
           selfloops = TRUE, size = 15,arrowgap = 0.05,ecolour = "grey40", repel = TRUE, 
           labelgeom = "text", labelcolour = "black") + theme_net()

head(NetY)
               from                      to Freq
1     Huishoudelijke hulp Ambulante Ondersteuning  481
2              Rolstoelen Ambulante Ondersteuning   24
3           Scootmobielen Ambulante Ondersteuning   41
4 Woonruimte aanpassingen Ambulante Ondersteuning   51
5     Huishoudelijke hulp            Dagbesteding  420
6              Rolstoelen            Dagbesteding   47

0 个答案:

没有答案