Closed Mdcrab02 closed 3 years ago
Hey I have ran your code in local and cloud machines and I didn't find any two outputs when running this code, Can you please post the output clarifying your issue
Yeah same, I did not get two images. Plus I would like to add I have used output = 'mpl'
a few times before and have never run into this problem. Is it possible that there is something wrong with your matplotlib. Maybe try running this code on IBMQ and then see how many images you get.
I have recreated a second qiskit environment and added only the bare minimum packages. This is the output I always get in Jupyter notebook and Jupyter lab.
It looks like there's a possibly related issue in Qiskit/qiskit-tutorials here 1180
Now Here is the explanation according to me.
In the new update of 0.25 the default style .draw()
is changed from text to 'mpl'
. There is a separate config file made to change the default settings in qiskit. So if you use %matplotlib inline
and .draw(output='mpl')
then it will use the matplotlib representation twice and will end up with two plots. If you don't use anything then by default run .draw()
as .draw('mpl)
. So I think if you remove every thing and use only draw()
then it will fix your problem
Thanks for the help @divshacker it turns out %matplotlib inline
is indeed part of the issue. I commented that out of the code and it now only shows one graph as expected.
Information
What is the current behavior?
In the version I have installed, the
.draw(output = 'mpl')
method always produces two plots in Jupyter notebook. Previous versions did not do this.The normal
.draw()
method with no parameters behaves as expected.Steps to reproduce the problem
If you remove
output = 'mpl'
from the.draw()
method, it produces one plot as expected.What is the expected behavior?
I'd expect that only one plot be produced.
Suggested solutions