Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created May 5, 2020 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiolucero/22ba0b79b729420362a250aec81fd9a1 to your computer and use it in GitHub Desktop.
Save sergiolucero/22ba0b79b729420362a250aec81fd9a1 to your computer and use it in GitHub Desktop.
Lines over Heatmap
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
flights = sns.load_dataset("flights");flights = flights.pivot("month", "year", "passengers")
fig, ax = plt.subplots(1, figsize=(16,8))
sns.heatmap(flights, cbar=False, annot=True, fmt='.0f', ax=ax)
for ix in range(12): # one per height
x = range(12); y = ix+1-flights.iloc[ix]/flights.iloc[ix].max()
h = plt.plot(x,y, lw=4)
plt.show()
@sergiolucero
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment