cirq.Heatmap
Distribution of a value in 2D qubit lattice as a color map.
cirq.Heatmap(
value_map: Union[Mapping[QubitTuple, SupportsFloat], Mapping[grid_qubit.GridQubit,
SupportsFloat]],
**kwargs
)
Used in the notebooks
Args |
value_map
|
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.
|
**kwargs
|
Optional kwargs including
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 constructed 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
plot(
ax: Optional[plt.Axes] = None, **kwargs
) -> Tuple[plt.Axes, mpl_collections.Collection]
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
update_config(
**kwargs
) -> 'Heatmap'
Add/Modify **kwargs args passed during initialisation.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-27 UTC."],[],[]]