cirq.plot_state_histogram
Plot the state histogram from either a single result with repetitions or a histogram computed using result.histogram()
or a flattened histogram of measurement results computed using get_state_histogram
.
cirq.plot_state_histogram(
data: Union['result.Result', collections.Counter, Sequence[SupportsFloat]],
ax: Optional[plt.Axes] = None,
*,
tick_label: Optional[Sequence[str]] = None,
xlabel: Optional[str] = 'qubit state',
ylabel: Optional[str] = 'result count',
title: Optional[str] = 'Result State Histogram'
) -> plt.Axes
Used in the notebooks
Args |
data
|
The histogram values to plot. Possible options are:
result.Result : Histogram is computed using
get_state_histogram and all 2 ** num_qubits values are
plotted, including 0s.
collections.Counter : Only (key, value) pairs present in
collection are plotted.
Sequence[SupportsFloat] : Values in the input sequence are
plotted. i'th entry corresponds to height of the i'th
bar in histogram.
|
ax
|
The Axes to plot on. If not given, a new figure is created,
plotted on, and shown.
|
tick_label
|
Tick labels for the histogram plot in case input is not
collections.Counter . By default, label for i'th entry
is |i>.
|
xlabel
|
Label for the x-axis.
|
ylabel
|
Label for the y-axis.
|
title
|
Title of the plot.
|
Returns |
The axis that was plotted on.
|
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.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "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."],[],[]]