matplotlib 1.4.2 with Seaborn: line markers not functioning

Note: this is fixed in 1.4.3 or later


I use the Seaborn plotting package and I just upgraded to the newest version of Matplotlib. Now, plots with dot symbols no longer render. Code that was functional before now creates blank plots, but only when Seaborn is imported. Here's some sample code:

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

print matplotlib.__version__

Matplotlib version:

1.4.2

Create a plot without seaborn:

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

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

Import seaborn, print the version:

import seaborn as sns
print sns.__version__

Seaborn version:

0.4.0

Create a line plot with seaborn imported:

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

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

Creating a dot plot with seaborn imported gives a blank set of axes:

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

Everything above was done in the IPython notebook, but I just tried the following in Spyder with the same result:

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()

What's going on?


It would appear that this is due to a bug in Matplotlib.

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

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

You might just have to downgrade for the time being.

PS: What's up Doug.


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

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

上一篇: 如何在android中通过twitter分享链接?

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