colormap.
Goal
Run every block.
df = pd.DataFrame({
"city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
"units": [21, 15, 15, 18, 12],
"shillings": [2100, 1500, 1480, 1750, 1190],
})
df.plot(x="city", y="units", kind="bar", colormap="viridis")
plt.show()df = pd.DataFrame({
"city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
"units": [21, 15, 15, 18, 12],
"shillings": [2100, 1500, 1480, 1750, 1190],
})
df.plot(x="city", y="units", kind="bar", color="#c45c26")
plt.show()df = pd.DataFrame({"mango": [12, 7], "soda": [9, 8]}, index=["Nairobi", "Mombasa"])
df.plot(kind="bar", colormap="tab10")
plt.show()print("One color for one series.")Pitfall
Always plt.show().