Matplotlib graph do not draw borders / edges

I have this code for my histogram.

ax1 = plt.subplot2grid((1,1),(0,0))
ax1.bar(edges2, Nnorm, width=0.02, edgecolor='green', linewidth=20)

I thought I should make my histogram green edges. But this is not so. He makes one bar on the left green field. What am I doing wrong? Facecolor works.

enter image description here

+6
source share
3 answers

Unfortunately, this is a bug in matplotlib 2.1 . It is fixed in matplotlib version 2.2.

Currently, a workaround is to set the edgecolor and linewidth widths for each column separately:

import matplotlib.pyplot as plt

bars = plt.bar(range(4), [3,4,1,5])
for bar in bars:
    bar.set_edgecolor("green")
    bar.set_linewidth(20)

plt.show()

enter image description here

+4
source

, matplotlib. , edgecolor, :

plt.bar(x, y, linewidth=20, edgecolor=['g']*len(x))
+1

- -:

plt.bar(range(4), [3,4,1,5], alpha=1, edgecolor='k', linewidth=20)

: , edgecolor , edgecolor,

+1

All Articles