2014-10-28 36 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) 
相關問題