-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integrated histogram visualizations #3942
Add integrated histogram visualizations #3942
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!! Looks pretty good % nits to follow your notation :)
cirq/vis/histogram.py
Outdated
color: Color of the line. | ||
linestyle: Linestyle to use for the plot. | ||
lw: linewidth for integrated histogram | ||
ms: marker size for a histogram trace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lw: linewidth for integrated histogram | ||
ms: marker size for a histogram trace | ||
label: An optional label which can be used in a legend. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hide_zero, title are missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added. Also modified hide_zero
to show_zero
to avoid double negation. (if not hide_zero
: do something special)
|
||
if not hide_zero: | ||
bin_values = np.linspace(0, 1, n + 1) | ||
parameter_values = sorted(np.concatenate(([0], data))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand this? It looks a bit fishy to me - we are modifying the data to show where zero is? Why not just modify the x axis min value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A step plot starts by plotting a horizontal line between the first (x0, y0) and (x1, y0) before going up from (x1, y0) to (x1, y1). Because of this, the first horizontal line would co-inside with x-axis (y values are generated by np.linespace
so first y
value would always be 0).
If hide_zero
is false, we move the plot up by 1 unit. For example, the left plot below is generated using hide_zero = True
and right plot is generated using hide_zero = False
.
This PR adds integrated histogram visualizations support to Cirq. Closes #3941
See https://tinyurl.com/cirq-visualizations for the larger roadmap item.
Usage:
calibration.plot('single_qubit_errors')
now produces the following image:Next steps
visualizing_calibration_metrics
tutorial will be updated in a follow up PR once this is checked in.