![]() ![]() show () # Read the documentation for a full list of available arguments: help ( Graph ) help ( InteractiveGraph ) help ( EditableGraph ) Examples draw () # force redraw to display changes fig. set_facecolor ( 'honeydew' ) # change background color fig. ![]() set_title ( "This is my fancy title." ) ax. subplots ( figsize = ( 5, 4 )) plot_instance = Graph (, node_labels = True, edge_labels = True, ax = ax ) plot_instance. # Node and edge artistis are derived from ``. show () # Netgraph uses Matplotlib for creating the visualisation. plot_instance = EditableGraph ( graph_data ) plt. show () # Create an editable plot, which is an interactive plot with the additions # that nodes and edges can be inserted or deleted, and labels and annotations # can be created, edited, or deleted as well. plot_instance = InteractiveGraph ( graph_data ) plt. # For related reasons, if you are using P圜harm, you have to execute the code in # a console (Alt+Shift+E). # NOTE: you must retain a reference to the plot instance! # Otherwise, the plot instance will be garbage collected after the initial draw # and you won't be able to move the plot elements around. show () # Create an interactive plot, in which the nodes can be re-positioned with the mouse. data # Create a non-interactive plot: Graph ( graph_data ) plt. Famous ( 'Zachary' ) # 6) graph_tool.Graph objects import graph_llection graph_data = graph_tool. karate_club_graph () # 5) igraph.Graph objects import igraph graph_data = igraph. rand ( 10, 10 ) # 4) networkx Graph and DiGraph objects (MultiGraph objects are not supported, yet) import networkx graph_data = networkx. Quickstart import matplotlib.pyplot as plt from netgraph import Graph, InteractiveGraph, EditableGraph # Several graph formats are supported: # 1) edge lists graph_data = # 2) edge list with weights graph_data = # 3) full rank matrices import numpy graph_data = np. Numerous tutorials, code examples, and a complete documentation of the API can be found on ReadTheDocs. If you are using (Ana-)conda (or mamba), you can also obtain Netgraph from conda-forge: conda install -c conda-forge netgraph Install the current release of netgraph from PyPI: pip install netgraph Finally, Netgraph also supports interactive changes: with the InteractiveGraph class, nodes and edges can be positioned using the mouse, and the EditableGraph class additionally supports insertion and deletion of nodes and edges as well as their (re-)labelling through standard text-entry. The highly customisable plots are created using Matplotlib, and the resulting Matplotlib objects are exposed in an easily queryable format such that they can be further manipulated and/or animated using standard Matplotlib syntax. ![]() Uniquely among Python alternatives, it handles networks with multiple components gracefully (which otherwise break most node layout routines), and it post-processes the output of the node layout and edge routing algorithms with several heuristics to increase the interpretability of the visualisation (reduction of overlaps between nodes, edges, and labels edge crossing minimisation and edge unbundling where applicable). Netgraph implements numerous node layout algorithms and several edge routing routines. To facilitate a seamless integration, Netgraph supports a variety of input formats, including networkx, igraph, and graph-tool Graph objects. Netgraph is a Python library that aims to complement existing network analysis libraries such as such as networkx, igraph, and graph-tool with publication-quality visualisations within the Python ecosystem. Publication-quality Network Visualisations in Python
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |