2014-10-28 35 views
6

注:这是固定在1.4.3或更高版本matplotlib 1.4.2 Seaborn:行标志不正常


我使用Seaborn绘图软件包和我刚刚升级到Matplotlib的最新版本。现在,点符号的绘图不再呈现。现在的代码现在可以创建空白图,但只有当Seaborn被导入时。下面是一些示例代码:

import matplotlib.pyplot as plt 
import matplotlib 
import numpy as np 

print matplotlib.__version__ 

Matplotlib版本:

1.4.2 

没有seaborn创建一个情节:

x = np.linspace(0,2,101) 
y = np.sin(2*np.pi*x) 
plt.plot(x,y,'.') 

sin function with dots at each data point

进口seaborn,打印版本:

import seaborn as sns 
print sns.__version__ 

Seaborn版本:

0.4.0 

创建seaborn线图的输入:

plt.plot(x,y,'-') 

sin function with a solid line connecting each data point

创建与进口seaborn点图给出了一个空白组轴:

plt.plot(x,y,'.') 

an empty set of axes

上面的一切在IPython的笔记本电脑完成,但我只是想在Spyder的具有相同的结果如下:

import matplotlib.pyplot as plt 
import matplotlib 
import numpy as np 

print matplotlib.__version__ 

x = np.linspace(0,2,101) 
y = np.sin(2*np.pi*x) 
plt.figure() 
plt.plot(x,y,'.') 

import seaborn as sns 
print sns.__version__ 
plt.figure() 
plt.plot(x,y,'-') 

plt.figure() 
plt.plot(x,y,'.') 

plt.show() 

这是怎么回事?

+0

我看到一个类似的问题与Matplotlib 2.0.0和seaborn 0.6.0,虽然在我的情况下,plotstyle'.'可以正常工作,但plotstyle'+'不能。 – abeboparebop 2017-04-24 12:38:31

回答

3

这似乎是由于Matplotlib中的错误。

https://github.com/matplotlib/matplotlib/issues/3711

https://github.com/mwaskom/seaborn/issues/344

你可能只需要降级暂时。

PS:Doug怎么了。

+0

我在seaborn问题线程中添加了关于seaborn中的解决方法的说明,暂时应该避免此问题。 – mwaskom 2014-10-28 21:35:55

+0

在seaborn问题线程上发布的解决方法解决了问题。为了节省其他人的点击费用,我在seaborn导入电话后填入以下内容:sns。set_context(rc = {'lines.markeredgewidth':0.1})。谢谢Derric和mwaskom! – ollerend 2014-10-28 21:45:58

+0

对于那些最终在这里但不点击问题的人来说,seaborn 0.5.1已经发布了,并解决了这个bug。 – mwaskom 2014-11-25 01:25:27

0

一种解决方法(在对方的回答GitHub的链接提到)是明确在呼叫建立markeredgewidth(或mew),以plot

plt.plot(x,y,'.', mew=1) 
相关问题