Skip to content

Commit 0ae3027

Browse files
committed
Example on multicolor edges
1 parent bfbedb4 commit 0ae3027

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

docs/source/sg_execution_times.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Computation times
88
=================
9-
**00:00.065** total execution time for 87 files **from all galleries**:
9+
**00:00.046** total execution time for 88 files **from all galleries**:
1010

1111
.. container::
1212

@@ -32,8 +32,8 @@ Computation times
3232
* - Example
3333
- Time
3434
- Mem (MB)
35-
* - :ref:`sphx_glr_gallery_style_plot_curved_waypoints.py` (``../../gallery/style/plot_curved_waypoints.py``)
36-
- 00:00.065
35+
* - :ref:`sphx_glr_gallery_style_plot_edge_multicolor.py` (``../../gallery/style/plot_edge_multicolor.py``)
36+
- 00:00.046
3737
- 0.0
3838
* - :ref:`sphx_glr_gallery_basic_plot_3d.py` (``../../gallery/basic/plot_3d.py``)
3939
- 00:00.000
@@ -182,6 +182,9 @@ Computation times
182182
* - :ref:`sphx_glr_gallery_style_plot_arrows.py` (``../../gallery/style/plot_arrows.py``)
183183
- 00:00.000
184184
- 0.0
185+
* - :ref:`sphx_glr_gallery_style_plot_curved_waypoints.py` (``../../gallery/style/plot_curved_waypoints.py``)
186+
- 00:00.000
187+
- 0.0
185188
* - :ref:`sphx_glr_gallery_style_plot_custom_vertex.py` (``../../gallery/style/plot_custom_vertex.py``)
186189
- 00:00.000
187190
- 0.0
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""
2+
Multicolor edges
3+
================
4+
5+
Sometimes the need arises to color edges with multiple colors at the same time. That's what multigraphs are for.
6+
This example shows the concept in action.
7+
8+
"""
9+
10+
import networkx as nx
11+
import matplotlib.pyplot as plt
12+
import iplotx as ipx
13+
14+
g = nx.MultiGraph()
15+
g.add_edges_from([(0, 1), (1, 2), (0, 2), (0, 1)])
16+
17+
layout = [(0, 0), (1, 0), (0.5, 1)]
18+
19+
ipx.network(
20+
g,
21+
layout,
22+
edge_color=["black", "gold", "tomato", "tomato"],
23+
edge_paralleloffset=8,
24+
edge_linewidth=4,
25+
vertex_size=40,
26+
vertex_facecolor="none",
27+
vertex_edgecolor="black",
28+
vertex_linewidth=4,
29+
)

0 commit comments

Comments
 (0)