我按照here的设置,使matplotlib/seaborn可以在齐柏林飞艇中显示。但是,使用以下代码:
%python
import seaborn as sns
import matplotlib
import numpy as np
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.rcdefaults()
import StringIO
def show(p):
img = StringIO.StringIO()
p.savefig(img, format='svg')
img.seek(0)
print "%html <div style='width:600px'>" + img.buf + "</div>"
""" Prepare your plot here ... """
# Use the custom show function instead of plt.show()
x = np.random.randn(100)
ax = sns.distplot(x)
show(sns.plt)
奇怪的是,在我第一次运行代码时,显示的图形显示了所需的浅蓝色,但如果我执行同一段代码,则会显示不同的颜色。有没有办法迫使seaborn保持恒定的颜色显示?谢谢。在
现在还不完全清楚“第二次跑步”是什么意思。在
但是,您可以在再次运行该图形之前尝试实际关闭该图形。E、 g
为了确保,会创建一个新图形,该图形每次都应具有相同的默认颜色。在
相关问题 更多 >
编程相关推荐