cirq.vis.Heatmap

Distribution of a value in 2D qubit lattice as a color map.

value_map dictionary A dictionary of qubits or QubitTuples as keys and corresponding magnitude as float values. It corresponds to the data which should be plotted as a heatmap.
title str, default = None
plot_colorbar bool, default = True
annotation_map dictionary, A dictionary of QubitTuples as keys and corresponding annotation str as values. It corresponds to the text that should be added on top of each heatmap polygon unit.
annotation_format str, default = '.2g' Formatting string using which annotation_map will be implicitly contstructed by applying format(value, annotation_format) for each key in value_map. This is ignored if annotation_map is explicitly specified.
annotation_text_kwargs Matplotlib Text **kwargs,
colorbar_position {'right', 'left', 'top', 'bottom'}, default = 'right'
colorbar_size str, default = '5%'
colorbar_pad str, default = '2%'
colorbar_options Matplotlib colorbar **kwargs, default = None,
collection_options Matplotlib PolyCollection **kwargs, default {"cmap" : "viridis"} vmin, vmax: colormap scaling floats, default = None

Methods

plot

View source

Plots the heatmap on the given Axes.

Args
ax the Axes to plot on. If not given, a new figure is created, plotted on, and shown.
kwargs The optional keyword arguments are used to temporarily override the values present in the heatmap config. See init for more details on the allowed arguments.

Returns
A 2-tuple (ax, collection). ax is the plt.Axes that is plotted on. collection is the collection of paths drawn and filled.

update_config

View source

Add/Modify **kwargs args passed during initialisation.