How to use the igraph.plot function in igraph

To help you get started, we’ve selected a few igraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vad / wiki-network / graph_analysis.py View on Github external
g.g.vs['size'] = [math.sqrt(v['weighted_indegree']+1)*10 for v
                              in g.g.vs]

            logging.debug('plot: begin')
            ig.plot(g.g, target=lang+"_general.png", bbox=(0, 0, 8000, 8000),
                    edge_color='grey', layout='drl')
            logging.debug('plot: end')
            weights = g.g.es['weight']
            max_weight = max(weights)

            g.g.es['color'] = [(255.*e['weight']/max_weight, 0., 0.) for e
                               in g.g.es]
            g.g.es['width'] = weights

            ig.plot(g.g, target=lang+"_weighted_edges.png", bbox=(0, 0, 4000,
                                                                  2400),
                    layout='fr', vertex_label=' ')


    if options.as_table:
        tablr.stop()

        #tablr.printHeader()
        #tablr.printData()
        tablr.saveInDjangoModel()


    if options.adjacency:
        giant = g.g.clusters().giant()
        #destAdj = "%s/%swiki-%s-adj.csv" % (os.path.split(fn)[0], lang, date)
        destAdj = "%swiki-%s-adj.csv" % (lang, date)
github SergiuTripon / msc-thesis-na-epsrc / analysis / src / communities.py View on Github external
# variable to hold edges
        edges = [edge for edge in network.es() if membership[edge.tuple[0]] != membership[edge.tuple[1]]]

        # delete edges
        network.delete_edges(edges)

        # variable to hold visual style
        visual_style = {'vertex_label': None,
                        'vertex_size': network.vs['plot_size'],
                        'edge_width': network.es['plot_weight'],
                        'layout': 'kk',
                        'bbox': (1000, 1000),
                        'margin': 40}

        # plot communities
        ig.plot(communities, '../../data/networks/{}/communities/png/'
                             '{}/{}/overview2.png'.format(path, edge_type, method), **visual_style)
github appleyuchi / Decision_Tree_Prune / several_wrong_implementations_CCP / CART-CCP-Python-visualize-simplified_CCP / tigraphs.py View on Github external
def plot(self):
        A = self.get_adjacency_matrix_as_list()
        convert_to_igraph = ig.Graph.Adjacency(A, mode='undirected')
        ig.plot(convert_to_igraph)
github appleyuchi / Decision_Tree_Prune / several_wrong_implementations_CCP / CART-CCP-Python-visualize-simplified_CCP / tigraphs.py View on Github external
def plot(self):
        A = self.get_adjacency_matrix_as_list()
        convert_to_igraph = ig.Graph.Adjacency(A)
        ig.plot(convert_to_igraph)
github SergiuTripon / msc-thesis-na-epsrc / analysis / src / network.py View on Github external
def plot_network(network, edge_type, method, path):

    # variable to hold visual style
    visual_style = {'vertex_label': None,
                    'vertex_color': 'blue',
                    'vertex_size': network.vs['plot_size'],
                    'edge_width': network.es['plot_weight'],
                    'layout': 'kk',
                    'bbox': (1000, 1000),
                    'margin': 40}

    # plot network
    ig.plot(network, '../../data/networks/{}/network/png/'
                     '{}/{}/network.png'.format(path, edge_type, method), **visual_style)
github ethz-asl / kalibr / aslam_offline_calibration / kalibr / python / kalibr_camera_calibration / MulticamGraph.py View on Github external
try:
            edgewidth=[]
            for edge_idx, edge in enumerate(self.G.es):
                if edge_idx in self.optimal_baseline_edges:
                    edgewidth.append(10)
                else:
                    edgewidth.append(2)
        except AttributeError:
            edgewidth = 2
        
        if not noShow:
            target = None
        else:
            target = "/tmp/graph.png"

        plot = igraph.plot(self.G, 
                           layout=layout, 
                           rescale=False, 
                           add=False,
                           target=target,
                           vertex_size=50,
                           edge_label=self.G.es["weight"],
                           edge_width=edgewidth,
                           margin = 50)
        
        if not noShow:
            return plot
        else:
            return target
github appleyuchi / Decision_Tree_Prune / CART-CCP剪枝-Python-可视化 / ticart.py View on Github external
g.vs[index]['color'] = 'red'
                 
            else:
                label=vertex.prediction
                g.vs[index]['color']='blue'
                g.vs[index]['label']=str(label)
                
                g.vs[index]['label_dist']=2
                g.vs[index]['label_color']='blue' 
        root_index = self.vertices.index(self.get_root())

        root_list=[]
        root_list.append(root_index)

        layout = g.layout_reingold_tilford(root=root_list)#这里喜欢接收list类型的数据
        ig.plot(g, layout=layout, margin=margin) 
github saezlab / pypath / src / drug_targets_sensitivity.py View on Github external
p70 = np.percentile(lsig_meta.es['weight'], 70)
lsig_meta80 = copy.deepcopy(lsig_meta)
lsig_meta80.delete_edges([e.index for e in lsig_meta80.es \
    if e['weight'] < p80])

sens.scatterplot([lsig_meta.vs['size']], [lsig_meta.vs['sig']], 'Community size', 
    'Community significance', 'size-signf-lsig.pdf', ylog = True,
    colors = [i[0] for i in sens.embl_pal[1:]])

lsig_meta80.layout = lsig_meta80.layout_fruchterman_reingold(weights = 'weight', 
        repulserad = lsig_meta80.vcount() ** 2.8, maxiter = 1000, 
        area = lsig_meta80.vcount() ** 2.3)
im_meta.vs['label'] = im_meta.vs['name']

sf = cairo.PDFSurface('lsig-metagraph-80.pdf', 600, 600)
igplot = igraph.plot(lsig_meta80, 
    target = sf,
    layout = lsig_meta80.layout,
    vertex_label = [','.join(v['members_gname'][:3]) for v in lsig_meta80.vs],
    vertex_label_size = 3,
    vertex_size = [sz/np.mean(lsig_meta80.vs['size'])*3 for sz in lsig_meta80.vs['size']],
    vertex_frame_width = 0, 
    vertex_color = '#22888888', vertex_label_color = '#88222288', 
    edge_width = lsig_meta80.es['weight'], edge_color = '#33333322', 
    edge_arrow_size = 0.1,
    edge_arrow_width = 0.1,
    edge_label_color = '#22228888')

igplot.redraw()
igplot.save()

###