python - matplotlib 1.4.2 与 Seaborn : line markers not functioning

标签 python numpy matplotlib seaborn

注意:这在 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 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 notebook 中完成的,但我只是在 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 怎么了。

关于python - matplotlib 1.4.2 与 Seaborn : line markers not functioning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26618339/

相关文章:

python - 结合使用 cython 和 gsl

python - Matplotlib imshow 反转二维 IFFT 数组的颜色

python - 更新散点图的标记大小

python - 在 matplotlib 中使用 bbox_inches ='tight' 时,如何获得具有精确大小(以像素为单位)的图像?

python - 如何通过一个请求创建多个资源Django Rest Framework?

python - GCP/Py : determine when compute engine instance is actually ready to be used (not "RUNNING")

python - 使用python进行帧差异

python - 理解 Python 中的 super

python - Python 中的递归类定义

python - OpenCV 和 Python : quickly superimpose mask over image without overflow