注意:这在 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 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/