Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython notebook 3 disables seaborn settings

I just upgraded to IPython Notebook version 3.0 and it's disabling the formatting for seaborn. Here's some sample code that replicates the problem

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

%matplotlib inline

data = np.random.randn(100)

fig,ax = plt.subplots(figsize = (11,8.5))
ax.plot(data)

This code works just fine in IPython Notebook V2.4.1 (see http://nbviewer.ipython.org/gist/anonymous/71733c24a68ee464ca40), but in IPython Notebook v3.0, the axes become invisible (see http://nbviewer.ipython.org/gist/anonymous/7525146b07709206908c).

Strangely, in V3, when I switch the order of the seaborn import and the matplotlib inline magic, the plot renders normally the first time I run, then if I re-run, the axes and gridlines disappear. So it seems to have something to do with the inline magic disabling seaborn properties.

Any workarounds, other than not re-executing my imports after the first time?

like image 710
ollerend Avatar asked Mar 12 '15 00:03

ollerend


1 Answers

In iPython Notebook 3.0, add:

seaborn.set_style('darkgrid')

to restore Seaborn default color schemes.

like image 131
mikal94305 Avatar answered Sep 28 '22 05:09

mikal94305