Panel (a) puts housing on the horizontal axis and "everything else" on the vertical. The original budget constraint, at housing price P₀, has its best choice at M₀. As the price of housing rises to P₁, P₂ and P₃ the constraint rotates in, and in, and in again, and the utility-maximizing choice moves to M₁, M₂ and M₃, with the quantity of housing falling from Q₀ to Q₁ to Q₂ to Q₃.
Panel (b) plots each price against the quantity of housing chosen at that price. The vertical dashed lines show that the quantities are the same in both panels, so M₀ becomes E₀ on the demand curve, M₁ becomes E₁, and so on. The demand curve is built from utility-maximizing choices, even though only prices and quantities can be measured. The sliders set how much the price rises at each step and how strongly the chosen quantity responds.