Skip to content

Fix histogram ylimit for multiple executions#1661

Merged
jaygambetta merged 2 commits into
Qiskit:masterfrom
mtreinish:fix-histogram-ylim
Jan 11, 2019
Merged

Fix histogram ylimit for multiple executions#1661
jaygambetta merged 2 commits into
Qiskit:masterfrom
mtreinish:fix-histogram-ylim

Conversation

@mtreinish
Copy link
Copy Markdown
Member

Summary

In the plot_histogram function there was a bug when there were multiple
executions passed into the function with the y axes bounds. We were
previously setting the ylimit for each iteration of loop which goes over
each execution. However we should look at the max probability across all
executions when determining the upper limit for the yaxis. This commit
fixes this change by saving all the probabilities in a list outside the
loop and then moving the ax.ylim() to the end of that loop.

Details and comments

Fixes: #1660

In the plot_histogram function there was a bug when there were multiple
executions passed into the function with the y axes bounds. We were
previously setting the ylimit for each iteration of loop which goes over
each execution. However we should look at the max probability across all
executions when determining the upper limit for the yaxis. This commit
fixes this change by saving all the probabilities in a list outside the
loop and then moving the ax.ylim() to the end of that loop.

Fixes: Qiskit#1660
@jaygambetta jaygambetta merged commit 588d9a3 into Qiskit:master Jan 11, 2019
@mtreinish mtreinish deleted the fix-histogram-ylim branch January 11, 2019 00:36
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
In the plot_histogram function there was a bug when there were multiple
executions passed into the function with the y axes bounds. We were
previously setting the ylimit for each iteration of loop which goes over
each execution. However we should look at the max probability across all
executions when determining the upper limit for the yaxis. This commit
fixes this change by saving all the probabilities in a list outside the
loop and then moving the ax.ylim() to the end of that loop.

Fixes: Qiskit#1660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plot_histogram() y axis bounds don't respect

2 participants