条形图中的线宽和边缘颜色

时间:2017-10-24 07:55:51

标签: python-3.x matplotlib

我在Matplotlib 2.1.0(Python 3.6)中发现了奇怪的行为。这是一个错误吗?

import matplotlib.pyplot as plt

# data
x = [0, 1, 2, 3, 4]
y = [1, 2, 3, 4, 5]

# I would expect two identical figures
fig, (ax1, ax2) = plt.subplots(1,2)
ax1.bar(x, y, edgecolor='red', linewidth=2)     # Is this a bug?
ax2.bar(x, y, edgecolor=['red']*5, linewidth=2) # This is what I expected

fig.show()

结果:

enter image description here

0 个答案:

没有答案
相关问题