networkx中的半粗边

时间:2018-03-11 19:41:09

标签: python matplotlib

我从scipy稀疏矩阵创建图形,我无法理解为什么边缘是半粗的。

from Mar11_daily_utils import *
import numpy as np
from scipy import sparse
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import networkx as nx

if __name__=='__main__':

        bin_adj_mats_file = "../binary_adj_mats_daily.pkl"
        adj_orig, features = read_data('', bin_adj_mats_file, False)

        graph_vals = nx.from_scipy_sparse_matrix(adj_orig[adj_orig.keys()[0]], create_using=nx.DiGraph())

        node_degrees = list(graph_vals.degree(graph_vals.nodes()).values())
        node_degrees_use = [index for index, value in enumerate(node_degrees) if value > 0.]
        subgraph_vals = graph_vals.subgraph(node_degrees_use)

        options = {
            'node_color': 'black',
            'node_size': 3,
            'line_color': 'red',
            'linewidths': 0.1,
            'width': 0.1
        }

        nx.draw(subgraph_vals, **options)
        plt.savefig('daily_so_graph_day_1.png') #len(subgraph_vals.node) says there are 414 nodes.

看起来像这样:

enter image description here

我怎样才能使边缘不是半粗体,而只是细线?

0 个答案:

没有答案