qiskit-metapackage
qiskit-metapackage copied to clipboard
.draw(output = 'mpl"), plot_bloch_multivector etc. produce two plots even after removing %matplotlib inline
Informations
-
Qiskit version: 'qiskit': '0.29.0' 'qiskit-terra': '0.18.1', 'qiskit-aer': '0.8.2', 'qiskit-ignis': '0.6.0', 'qiskit-ibmq-provider': '0.16.0', 'qiskit-aqua': '0.9.4', 'qiskit-nature': '0.1.5', qiskit-finance': '0.2.0', 'qiskit-optimization': '0.2.1', 'qiskit-machine-learning': '0.2.0'
-
Python version: 3.9.6 with ipython 7.20.0
-
Operating system: Windows 10 using WSL 2
What is the current behavior?
Using the .draw(output = 'mpl')
for a QuantumCircuit
object or the function plot_bloch_multivector
results in two copies of the same picture even if %matplotlib inline
has been disabled.
Steps to reproduce the problem
This is the code I run in one code block:
import qiskit
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_bloch_multivector
import math
qc = QuantumCircuit(2)
qc.h(0)
qc.h(1)
qc.draw(output='mpl', scale=1)
followed by the next code block:
out_vector = execute(qc, Aer.get_backend('statevector_simulator')).result().get_statevector()
plot_bloch_multivector(out_vector, reverse_bits=True)
What is the expected behavior?
Should get only one single plot per code block
Suggested solutions
The suggested solution from https://github.com/Qiskit/qiskit/issues/1265 of removing %matplotlib inline
does not work
Even i am facing the same issue with the following version
{'qiskit-terra': '0.18.1', 'qiskit-aer': '0.8.2', 'qiskit-ignis': '0.6.0', 'qiskit-ibmq-provider': '0.16.0', 'qiskit-aqua': '0.9.4', 'qiskit': '0.29.0', 'qiskit-nature': None, 'qiskit-finance': None, 'qiskit-optimization': None, 'qiskit-machine-learning': None}
Hey @albspe @jaswin90 This was fixed in Qiskit/qiskit-terra#6889. Maybe there could be any kernel problem you can try the solution suggested.
Should hopefully have been fixed by Qiskit/qiskit-terra#6889. Please feel free to re-open on the Qiskit Terra repo if that's not the case.