# The meaning of the city plot in Qiskit

I read the documentation of qiskit and I can't understand the meaning of the city plot, like this:

Why do we need a 3D plot? Why can't we just use a 2D plot, where $$| 00\rangle$$, $$| 01 \rangle$$, $$|10 \rangle$$, $$|11 \rangle$$ would lie on X-axis, and their amplitudes (or magnitudes) would lie along Y-axis?

What does the intersection of $$| 00 \rangle$$ and $$| 11 \rangle$$ show on such city plot?

A density matrix $$\rho$$ on two qubits has 16 complex amplitudes (although not all are free variables due to constraints from normalization and Hermeticity), so the City plot is showing those amplitudes as well. The $$|00\rangle\langle 11|$$ and $$|11\rangle\langle 00|$$ amplitudes shown are not going to directly impact your measurement if you were to measure in the Z basis, but would come into effect due to basis transformations.

As a simple example of these off diagonal elements, Think about a single qubit density matrix representing a $$|+\rangle$$ state:

$$\rho = |+\rangle\langle +| = \frac{1}{2}(|0\rangle + |1\rangle )(\langle 0| + \langle 1|) = \frac{1}{2}(|0\rangle\langle 0| + |1\rangle\langle 0| + |0\rangle\langle 1| + |1\rangle\langle 1|)$$

When measured in the Z basis this state gives a 50% chance of 0 and a 50% chance of 1, which is identical to the mixed state:

$$\rho ' = \frac{1}{2}(|0\rangle\langle 0| + |1\rangle\langle 1|)$$

However in the X basis our $$|+\rangle$$ state will always give an eigenvalue of 1, while the mixed state will give other results.

As an aside, these off diagonal elements are important when checking the purity of a quantum state:

$$\rho^2 = \rho$$

If this equation is satisfied then your state is pure, which is only possible due to the off diagonal elements in the density matrix.