freealg.visualization.plot_flow#

freealg.visualization.plot_flow(sizes, x, rho, eig_init, eig_final, rho_dash=None, delta=None, ax=None, figsize=None, xlim=None, ylim=None, share_ax=False, plot_middle=True, plot_floor=True, cmap=None, c_range=None, hist_color=None, nbins=(80, 120), label_mode='int', layout='horizontal', log=False, title='Free Decompression', inset_ax=None, inset_pos=None, inset_lims=None, save=False, latex=False)#

Plot density evolution at various decompression sizes.

Parameters:
sizesarray_like

A list of matrix decompression sizes. The length of this list should be the same as the number of rows of rho.

xnumpy.array

The abscissa to plot density. The length of this array should be the same as the number of columns of rho.

rhonumpy.ndarray

A 2D array where the row rho[i, :] correspond to a density at the matrix size sizes[i].

eig_initnumpy.array

The empirical eigenvalues corresponding to the initial matrix at the size sizes[0]. The histogram of this array is used to compare with rho[0, :].

eig_finalnumpy.array

The empirical eigenvalues corresponding to the final matrix at the size sizes[-1]. The histogram of this array is used to compare with rho[-1, :].

rho_dashnumpy.ndarray, default=None

Same as rho, but this is plotted with dashed curves.

deltafloat, default=None

Poisson kernel \(\delta\)-floor. This is only used when log=True.

axmatplotlib.axes._axes.Axes

matplotlib’s axis object. If None, new axis and figure is created.

figsizetuple, default=None

Figure size as (width, height).

xlimtuple, default=None

The limits (x_min, x_max) of the x axis in the plot. If None, minimum and maximum of x is used.

ylimtuple or list of tuples, default=None,

if a tuple (ymin, ymax) is given, the y limit for all axes is set as so. If a list of tuples [(ymin1, ymax1), ..., (ymin3, ymax3)] is given, each tuple in the list is used for each axis respectively. If None, an automatic y limit for all axes is set.

share_axbool, default=False

If True, the x axis (in vertical layout) or y axis (in horizontal layout) for all axes is shared. See layout.

plot_middlebool, default=True

If True, three axes are plotted, where the first axis is the density at the initial time, the second axis is the flow from initial to final time, and the third axis is the final time. If False, the second axis is not plotted.

plot_floorbool, default=True

If True, it plots Poisson’s kernel \(\delta\) floor curve, which is defined by \(P(x) = (\delta / \pi) / (x^2 + \delta^2)\).

cmapmatplotlib.cm.cmap, default=None

The colormap used for the color progression for each density curve.

c_rangedefault=(0, 1)

The range of the cmap to clip the color range of the colormap.

hist_colorstr or list, default=None

Color name of both histograms. If a string, the color is used for both histograms. If a list of two strings, each string is used for a histogram.

nbinstuple or scalar, default=(80, 120)

Number of bins for the histograms. It can be given as a tuple of length two, in which it sets the number of bins for both histograms, or it can be given as be scalar, which is used both both histograms.

label_mode{'int', 'dec', 'pow-int', 'pow-dec'}, default= 'int'

Decimal representation in legend labels:

  • 'int': integer.

  • 'dec': decimal with only one decimal fraction digit.

  • 'pow-int': Integer powers of base 2.

  • 'pow-dec': Decimal powers of base 2 with one decimal power.

layout{'horizontal', 'vertical'}, default = 'horizontal'

The layout of three axis: vertical is better for log-scale plots, otherwise use or horizontal.

logbool, default=False

If True, the x and y axis are shown in logarithmic scale.

titlestr, default=``’Free Decompression’``

Title of the center plot.

inset_axlist, default=None

List of indices of axes to inset inset axis. For example, to include inset to the middle and last axes, use [1, 2].

inset_poslist, default=None

The relative position of an inset to each axis frame as [left_x, left_y, width, height].

inset_limslist, default=None

List of two tuples [(x_min, x_max), (y_min, y_max)] as the x-lim and y-lim of the inset axes.

savebool or str, default=False

If False, the plot is not saved. If True, the plot is saved with a default filename. If string, the plot is saved with the full-path filename and file extension given by the string.

latexbool, default=False

If True, the plot is rendered using LaTeX.

See also

plot_mass
ridgeplot