Seaborn
Learning outcomes
At the end of this sessions, learners …
understand why Seaborn is important
have run Python code that uses Seaborn
Loading Seaborn
HPC cluster |
How to load Seaborn |
|---|---|
Alvis |
|
Kebnekaise |
|
COSMOS |
|
Pelle |
|
Tetralith |
|
Dardel |
|
Exercises
import matplotlib.pyplot as plt
plt.style.use('classic')
%matplotlib inline
import numpy as np
import pandas as pd
# Create some data
rng = np.random.RandomState(0)
x = np.linspace(0, 10, 500)
y = np.cumsum(rng.randn(500, 6), 0)
# Plot the data with Matplotlib defaults
plt.plot(x, y)
plt.legend('ABCDEF', ncol=2, loc='upper left');
import seaborn as sns
sns.set()
# same plotting code as above!
plt.plot(x, y)
plt.legend('ABCDEF', ncol=2, loc='upper left');
data = np.random.multivariate_normal([0, 0], [[5, 2], [2, 2]], size=2000)
data = pd.DataFrame(data, columns=['x', 'y'])
# Two overlaid density plots
for col in 'xy':
sns.kdeplot(data[col], shade=True)
# Density plot
sns.kdeplot(data);