The visualization workbench

Two plots; why plt.show().

The Matplotlib editor draws after plt.show(). NumPy is np. Matplotlib is plt.

Goal

Draw a bar and a line.

df = pd.DataFrame({
    "city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
    "units": [21, 15, 15, 18, 12],
    "shillings": [2100, 1500, 1480, 1750, 1190],
})
plt.bar(df["city"], df["units"], color="#1d4f7a")
plt.title("Kiosk units")
plt.ylabel("units")
plt.show()
x = np.linspace(0, 2 * np.pi, 80)
plt.plot(x, np.sin(x))
plt.title("A line to prove plt.show")
plt.show()
Pitfall

Without plt.show() the Plot panel stays empty.