In [1]:
%matplotlib inline
In [28]:
import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import time
In [35]:
# np.random.seed(sum(map(ord, "aesthetics")))
rng = np.random.RandomState(seed=1069) # same as the code above, which a pretentious way of setting seed = 1069
First we make a plot example.
In [12]:
def sinplot(flip=1):
x = np.linspace(0, 14, 100)
for i in range(1, 7):
plt.plot(x, np.sin(x + i * .5) * (7 - i) * flip)
When we call it, matplotlib plots things with its defaults. Note that seaborn hasn't been import yet in any code thus far.
In [20]:
sinplot(1)
To get seaborn styling, merely import the package:
In [21]:
import seaborn as sns
In [23]:
sinplot()
from the docs:
In [32]:
for style in ('darkgrid', 'whitegrid', 'dark', 'white', 'ticks'):
sns.set_style(style)
sinplot()
plt.show()
In [60]:
rng = np.random.RandomState(1)
data = rng.normal(size=(20, 6)) + np.arange(6) / 2
sns.set_style('whitegrid')
sns.boxplot(data)
Out[60]:
We can also use despine() to remove axes bars on the bottom, left, right and/or top of the plot area. This call must come after the plots have been generated.
In [64]:
sns.set_style('darkgrid')
sinplot()
sns.despine(right = False, left = True)