Seaborn Heatmap Example


This example was taken from http://seaborn.pydata.org/examples/heatmap_annotation.html.


In [2]:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

# Load the example flights dataset and conver to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")

# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax)


Out[2]:
<matplotlib.axes._subplots.AxesSubplot at 0x7ffa2f717a90>

In [ ]: