plot - 如何解决 R 中 ggraph 中的“仅支持连接图”问题?
问题描述
我有一个图形对象,但是当使用 ggraph() 使用布局'sparse_stress'(也尝试过其他布局)进行绘制时,它会出现以下错误。
min(degree) 为 1。没有断开的节点。“仅支持连接图”的错误是什么意思?
Subgraph_1994 = asIgraph(Subgraph_1994)
#sparse-stress gives error
ggraph(Subgraph_1994_Rev,layout="sparse_stress") + geom_edge_link() + geom_node_point() + theme_graph()
#also tried below but same error
ggraph(Subgraph_1994) + geom_edge_link() + geom_node_point() + theme_graph()
错误信息
Error in layout_with_sparse_stress(graph, pivots = pivots, weights = weights, : only connected graphs are supported.
解决方案
Min(degree)=1 表示确实没有断开的节点,但仍然可能存在断开的图。请参阅githubgraphlayouts
上的README
layout="sparse"
如果图表不是太大,设置应该可以解决您的问题。
推荐阅读
- javascript - 有什么方法可以仅使用 Leaflet.js 获得类似“超级任天堂模式 7 上的 JRPG”的平面 3D 地图?
- linux-kernel - USB 设备驱动程序的字符设备接口
- pine-script - 退出策略以达到一定的效果
- flutter - @freezed copyWith 缺少密封类
- css - 如何在 Swiper React 轮播中悬停时暂停 Swiper 分页项目符号进度条动画
- c - 打印同名 C 文件源代码的 C 程序
- actions-on-google - 从 AOG 向 Dialogflow 发出多个 HTTP 调用
- awk - 使用 sed 或 awk 用空格填充正则表达式
- flutter - 清除控制器文本字段颤动
- reactjs - Redux Saga 处理 post action 逻辑