2
$\begingroup$
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer
from qiskit import Aer
from qiskit import execute
import numpy as np
%matplotlib inline

This is the code cell that I am trying to implement. The error is in the second line.

Error--> ImportError: cannot import name 'matplotlib_circuit_drawer'

I'm using Google Colab to execute the code. How to solve this?

$\endgroup$
2
$\begingroup$

qiskit.tools.visualization has been moved to qiskit.visualization and matplotlib_circuit_drawer has been removed. Instead of using it, try using qiskit.visualization.circuit_drawer() with the appropriate arguments.

So in this case it should be qiskit.visualization.circuit_drawer(my_circuit, output='mpl', filename='my_circuit.png')

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.