Visualization¶

trueq.visualization.general.
multiply_lightness
(color, amount=0.5)¶ Modifies a color by multiplying (1lightness) by the given amount. Numbers less than 1 result in a lighter color, and numbers greater than 1 result in a darker color.
https://gist.github.com/ihincks/6a420b599f43fcd7dbd79d56798c4e5a
multiply_lightness("g", 0.3) multiply_lightness("#F034A3", 0.6) multiply_lightness((0.3, 0.55, 0.1), 0.5)
 Parameters
color (
str
tuple
) – A matplotlib color string, hex string, or RGB tuple.amount (
float
) – The amount to multiply (1lightness) of the input color by.
 Returns
An RGB tuple.
 Return type
tuple

trueq.visualization.general.
plot_mat
(mat, xlabels=2, ylabels=2, show_values=True, ax=None)¶ Plots a complex matrix with labeling with the following properties:
Color is dictated by the complex angle of each cell.
Transparency (alpha) is decided by the magnitude of each cell.
Size of plot scales based on shape of
mat
.
phase = [np.exp(1j * t *np.pi) for t in np.linspace(0, 1, 16)] plot_mat(np.outer(phase, phase))
 Parameters
mat (
numpy.ndarray
like) – A real or complex matrix.xlabels (
int
Iterable
None
) – EitherNone
, an iterable of labels for the xaxis, or the dimension of the subsystems where the x axis labels are the computational basis states as inferred from the size of mat. IfNone
, the axis will be labelled by the numbers that index the columns.ylabels (
int
Iterable
None
) – EitherNone
, an iterable of labels for the yaxis, or the dimension of the subsystems where the x axis labels are the computational basis states as inferred from the size of mat. IfNone
, the axis will be labelled by the numbers that index the rows.show_values (
bool
) – Whether to show the numeric values of the matrix in each cell.ax (
matplotlib.Axis
) – An existing axis to plot on. If not given, a new figure will be created.
Note
The following methods and classes typically should not be invoked by users. Their
plotting methods are exposed dynamically by the attributes
trueq.CircuitCollection.plot
and trueq.parameters.ParameterCollection.plot
.