Compare matrix columns visually¶
- class pyyeti.column_plotter.ColumnPlotter(x, dct, column_labels=None)[source]¶
A very basic class to visually compare matrices by plotting columns in an interactive window.
The user can scroll forward and backward through the columns of data, while using the plotting tools provided by matplotlib (such as zoom).
Examples
>>> import numpy as np >>> from pyyeti.column_plotter import ColumnPlotter >>> # >>> h = 0.01 >>> t = np.arange(0, 1, h) >>> sin = np.sin(3 * 2 * np.pi * t) >>> sin_a = sin + np.random.randn(*sin.shape) * 0.1 >>> sin_b = sin + np.random.randn(*sin.shape) * 0.1 >>> A = np.column_stack((sin, sin_a, sin_b)) >>> B = A + np.random.randn(*A.shape) * 0.2 + 2 >>> C = A + np.random.randn(*A.shape) * 0.2 + 3 >>> # >>> cp = ColumnPlotter( ... t, ... dict(A=A, B=B, C=C), ... ["1st column", "2nd column", "3rd column"], ... )
- __init__(x, dct, column_labels=None)[source]¶
Instantiates a
ColumnPlotterobject- Parameters:
x (1d array_like) – The x-axis data
dct (dict) – Dictionary of y-axis data. The key is the label for the data and will be in the legend. The values are the matrices to compare and the number of rows must equal
len(x). All matrices are expected to be the same size.column_labels (list or None; optional) – List of strings to be used for the plot titles;
len(column_labels)is expected to be equal to the number of columns in the y-axis data matrices.