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?


In iPython Notebook 3.0, add:

seaborn.set_style('darkgrid')

to restore Seaborn default color schemes.

链接地址: http://www.djcxy.com/p/25248.html

上一篇: 如何为模板中的django表单字段赋值?

下一篇: Ipython笔记本3禁用seaborn设置