带有Seaborn的matplotlib 1.4.2:线条标记不起作用

注意:这在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,'.')

sin函数在每个数据点处都有点

导入seaborn,打印版本:

import seaborn as sns
print sns.__version__

Seaborn版本:

0.4.0

用seaborn导入创建一个线条图:

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

sin函数用实线连接每个数据点

用导入的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:Doug怎么了?


解决方法(在其他答案中的GitHub链接中提到)是在调用plot明确设置markeredgewidth (或mew ):

plt.plot(x,y,'.', mew=1)
链接地址: http://www.djcxy.com/p/82207.html

上一篇: matplotlib 1.4.2 with Seaborn: line markers not functioning

下一篇: Selecting different customDimensions on BigQuery integration of GA