-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalluvial_subdiagrams.py
50 lines (43 loc) · 1.31 KB
/
alluvial_subdiagrams.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
========================================
Alluvial Demo - Working with subdiagrams
========================================
An alluvial plot can consist of several vertically stacked sub-diagrams.
"""
import matplotlib.pyplot as plt
import numpy as np
# from matplotlib.alluvial import Alluvial
from pyalluv import Alluvial
ext = np.array([1, 3, 1])
flows = [[[0, 1, 0],
[0, 1, 0],
[0, 0, 1],
[1, 0, 0]],
[[0, 1, 0, 0],
[1, 0, 1, 1]]]
extouts = [[(1, (1, 1, 2), 1)], []]
# Start with an empty alluvial plot
alluv = Alluvial(x=['t1', 't2', 't3'], blockprops=dict(width=0.2))
# Add the first subdiagram
alluv.add(flows=flows, ext=ext, extout=extouts, yoff=0,
layout=['top', 'top', 'top'])
# Adding a new subdiagram, using the same flows
alluv.add(flows=flows, ext=ext, yoff=7,
layout=['top', 'optimized', 'bottom'])
alluv.finish()
plt.show()
#############################################################################
#
# ------------
#
# References
# """"""""""
#
# The use of the following functions, methods, classes and modules is shown
# in this example:
import matplotlib
matplotlib.alluvial
matplotlib.alluvial.Alluvial
matplotlib.alluvial.Alluvial.from_memberships
matplotlib.alluvial.Alluvial.finish
matplotlib.alluvial.Alluvial.add_from_memberships