dit.visualization
Visualizations of multivariate distributions.
This subpackage collects plotting tools for exploring the structure of joint distributions. Currently it provides an UpSet-style plot of the atoms of a distribution’s information diagram, which scales to an arbitrary number of random variables (unlike Venn/Euler diagrams).
Classes
An UpSet plot of the atoms of a distribution's information diagram. |
Reference
- class InformationUpsetPlot(dist, *, partition=<class 'dit.profiles.information_partitions.ShannonPartition'>)[source]
Bases:
objectAn UpSet plot of the atoms of a distribution’s information diagram.
The plot has three coordinated panels:
a matrix whose rows are random variables and whose columns are the atoms of the information diagram; a filled dot means the variable participates in that atom (an unconditioned variable), an empty dot means it is conditioned upon;
an atom bar chart (above the matrix) giving each atom’s value, colored by sign since information atoms may be negative;
a variable bar chart (beside the matrix) giving each variable’s marginal entropy
H[X_i].
- dist
The distribution being visualized.
- Type:
- partition
The information partition supplying the atoms.
- Type:
BaseInformationPartition
- atoms
One entry per atom, each with keys
members(frozenset of the participating variables),conditions(frozenset of the conditioned variables),degree(number of members) andvalue.
- draw(ax=None, *, sort_by='value', min_degree=1, show_values=True, color_positive='C0', color_negative='C3')[source]
Draw the UpSet plot using matplotlib.
- Parameters:
ax (Axis or None) – An existing matplotlib axis whose location is used to host the panels. If None, a new figure is created.
sort_by (str) – How to order the atom columns; see
_sorted_atoms().min_degree (int) – Only draw atoms of at least this degree.
show_values (bool) – Annotate each atom bar with its value.
color_positive (color) – The color for non-negative atoms.
color_negative (color) – The color for negative atoms.
- Returns:
axes – A dictionary with keys
"atoms","matrix", and"sizes"mapping to the three panel axes.- Return type: