-1
$\begingroup$

How to use matplotlib to draw the following image, hoping that the 3D histogram is at the coordinate intersection?

enter image description here

I can only do it as follows

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

You can check out how to use plot_state_city in the documentation for the visualization function. The example you are showing seems to change the default colors to color=['blue', 'yellow'] and the title:

from qiskit import QuantumCircuit
from qiskit.quantum_info import DensityMatrix
from qiskit.visualization import plot_state_city

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)

state = DensityMatrix.from_instruction(qc)
plot_state_city(state, color=['blue', 'yellow'], title="New State City")

plot_state_city(state, color=['blue', 'yellow'], title="New State City")

$\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.