Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Problem
Colored edges look ugly:
I want bars with black edges and colored hatch:
My current workaround is to draw the bars twice, once with colored hatch and then a second time only with black edges:
importmatplotlib.pyplotaspltimportnumpyasnpwidth=0.35x=np.arange(4)+1y_red= [1,3,1,4]y_blue= [2,2,4,1]plt.bar(x-0.5*width,y_red,width,label="Height of red bars",hatch="////",facecolor=(0,0,0,0),edgecolor="red")plt.bar(x-0.5*width,y_red,width,facecolor=(0,0,0,0),edgecolor="black")plt.bar(x+0.5*width,y_blue,width,label="Height of blue bars",hatch=r"\\",facecolor=(0,0,0,0),edgecolor="blue")plt.bar(x+0.5*width,y_blue,width,facecolor=(0,0,0,0),edgecolor="black")plt.xticks(x)plt.yticks([0,1,2,3,4])plt.legend()plt.savefig("hatch.png")plt.show()
This workaround is not optimal because the legend is wrong.
Proposed solution
I propose ahatchcolor
parameter which is independent ofedgecolor
.