You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何用litstudy生成布局合理的静态网络图?

问题:生成布局合理的静态合著网络图

问题背景

使用litstudy模块加载Scopus导出的学术论文属性CSV文件,构建合著网络并绘图(绘图依赖pyvis模块)时遇到以下问题:

  • 交互式模式下网络图布局良好,但节点会随意移动,不利于分析
  • 将litstudy.network.plot_network()的interactive参数设为False后,节点出现严重重叠
    期望得到布局合理的静态网络图。

尝试的代码

soc_path = (
r'C:/Documents/Post_Doc/Writing_and_Learning/Lit_Review/Web_of_Science_Seagrass_Organic_Carbon.csv'
)

hab_path = (
r'C:/Documents/Post_Doc/Writing_and_Learning/Lit_Review/Web_of_Science_Seagrass_Habitat_Mapping.csv'
)

def scopus_doc_generator(path):# , year
    
    docs = litstudy.load_scopus_csv(path.replace('.csv', '_amended.csv'))
    
    #docs_refined = docs.filter_docs(lambda d: d.publication_year >= year)

    docs_found, docs_not_found = litstudy.refine_crossref(docs) 
    
    return docs_found

soc_docs_found = scopus_doc_generator(soc_path) #, 2000

hab_map_docs_found = scopus_doc_generator(hab_path) #, 2000

total_docs_found = soc_docs_found | hab_map_docs_found

coauthor_network = litstudy.build_coauthor_network(total_docs_found)

litstudy.network.plot_network(
    coauthor_network, max_node_size = 75, interactive = False
)

解决方法

  1. 修改pyvis的template.html文件
  2. 在litstudy的network.py文件的plot_network函数中添加以下代码:
template_dir = '你保存修改后template.html文件的路径'
v.set_template_dir(template_dir)

return v.show(file_name)

内容的提问来源于stack exchange,提问作者GeologicalInvestigator

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 01:45:09