hvplot.networkx.draw#

hvplot.networkx.draw(G, pos=None, **kwargs)[source]#

Draw the graph G using hvPlot.

Draw the graph with hvPlot with options for node positions, labeling, titles, and many other drawing features.

Parameters:
Ggraph

A networkx graph

posdictionary, optional

A dictionary with nodes as keys and positions as values. If not specified a spring layout positioning will be computed. See networkx.drawing.layout for functions that compute node positions.

arrowsbool, optional (default=True)

For directed graphs, if True draw arrowheads. Note: Arrows will be the same color as edges.

arrowhead_lengthfloat, optional (default=0.025)

The length of the arrows as fraction of the overall extent of the graph

with_labelsbool, optional (default=True)

Set to True to draw labels on the nodes.

nodelistlist, optional (default G.nodes())

Draw only specified nodes

edgelistlist, optional (default=G.edges())

Draw only specified edges

node_sizescalar or array, optional (default=300)

Size of nodes. If an array is specified it must be the same length as nodelist.

node_colorcolor string, node attribute, or array of floats, (default=’r’)

Can be a single color, the name of an attribute on the nodes or sequence of colors with the same length as nodelist. If the node_color references an attribute on the nodes or is a list of values they will be colormapped using the cmap and vmin, vmax parameters.

node_shapestring, optional (default=’o’)

The shape of the node. Specification is as valid bokeh marker.

alphafloat, optional (default=1.0)

The node and edge transparency

cmapColormap, optional (default=None)

Colormap for mapping intensities of nodes

vmin,vmaxfloat, optional (default=None)

Minimum and maximum for node colormap scaling

linewidths[None | scalar | sequence]

Line width of symbol border (default =1.0)

edge_widthfloat, optional (default=1.0)

Line width of edges

edge_colorcolor string, or array of floats (default=’r’)

Can be a single color, the name of an attribute on the edges or sequence of colors with the same length as the edges. If the edge_color references an attribute on the edges or is a list of values they will be colormapped using the edge_cmap and edge_vmin, edge_vmax parameters.

edge_cmapMatplotlib colormap, optional (default=None)

Colormap for mapping intensities of edges

edge_vmin,edge_vmaxfloats, optional (default=None)

Minimum and maximum for edge colormap scaling

stylestring, optional (default=’solid’)

Edge line style (solid|dashed|dotted,dashdot)

labelsdictionary or string, optional (default=None)

Node labels in a dictionary keyed by node of text labels or a string referencing a node attribute

font_sizeint, optional (default=12)

Font size for text labels

font_colorstring, optional (default=’black’)

Font color string

font_familystring, optional (default=’sans-serif’)

Font family

labelstring, optional

Label for graph legend

selection_policystring, optional (default=’nodes’)

Whether to select ‘nodes’, ‘edges’ or None on tap and selection events.

inspection_policystring, optional (default=’nodes’)

Whether to select ‘nodes’, ‘edges’ or None on tap and selection events.

geoboolean, optional (default=False)

Whether to return a GeoViews graph

crscartopy.crs.CRS

A cartopy coordinate reference system (enables a geographic plot)

heightint, optional (default=400)

The height of the plot in pixels

widthint, optional (default=400)

The width of the plot in pixels