注意:这在 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__
海生版本:
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()
这是怎么回事?