0
$\begingroup$

Why doesn't Qiskit visualization work on Python IDLE 3.X like circuits.draw(), plot_histogram() and plot_bloch_vector()? Is there any way to make visualization module work on Python IDLE 3.X?

$\endgroup$
  • 2
    $\begingroup$ Hello! What do you mean by it doesn't work, does it throw up an error? $\endgroup$ – met927 Dec 15 '19 at 22:47
  • $\begingroup$ No,It doesn't show any error but even it doesn't plot anything.Although it's prints results and counts properly @met927 $\endgroup$ – quantum_boy Dec 16 '19 at 16:50
1
$\begingroup$

These functions don't automatically display their output, unless you are running the code in a Jupyter notebook. I would recommend you switch over to using a Jupyter notebook if you can (you can do this inside the IBM Q Experience) as this will display all the plots for you, as long as the calls to these functions are the last line of the cell.

If this is not possible, you can display the circuit using ASCII art by calling print(circuit.draw()) or saving it to a file using circuit.draw(output='mpl', filename='circuit.png'). As for the other plotting methods, these return matplotlib images so you should be able to see them by doing plt.show() or save the figure by doing

bloch = plot_bloch_vector()
bloch.savefig('bloch.png')
| improve this answer | |
$\endgroup$

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