[英]matplotlib 1.4.2 with Seaborn: line markers not functioning
注意:這在1.4.3或更高版本中已得到修復
我使用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,'.')
進口seaborn,打印版本:
import seaborn as sns
print sns.__version__
Seaborn版本:
0.4.0
使用seaborn導入創建線圖:
plt.plot(x,y,'-')
使用seaborn導入創建點圖會產生一組空白軸:
plt.plot(x,y,'.')
上面的所有內容都是在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()
這是怎么回事?
看起來這是由於Matplotlib中的一個錯誤。
https://github.com/matplotlib/matplotlib/issues/3711
https://github.com/mwaskom/seaborn/issues/344
您可能只需要暫時降級。
PS:怎么了道格。
解決方法(在另一個答案的GitHub鏈接中提到)是在對plot
的調用中顯式設置markeredgewidth
(或mew
):
plt.plot(x,y,'.', mew=1)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.