Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug report
Bug summary
When size_vertical is provided, the resulting sizebar is bigger than expected because of the additional edges have the same
Code for reproduction
importmatplotlib.pyplotaspltfrommpl_toolkits.axes_grid1.anchored_artistsimportAnchoredSizeBarfig,ax=plt.subplots()fig, (ax,bx)=plt.subplots(2,1)wrong_scalebar=AnchoredSizeBar(ax.transData,.2,'','lower left',pad=0,color='#FF0000',frameon=False,size_vertical=.5,label_top=True)expected_scalebar=AnchoredSizeBar(ax.transData,.2,'','lower left',pad=0,color='#00FF007F',frameon=False,size_vertical=.5,label_top=True)expected_scalebar.size_bar.get_children()[0].set_edgecolor("none")ax.add_artist(wrong_scalebar)ax.add_artist(expected_scalebar)expected_scalebar=AnchoredSizeBar(ax.transData,.2,'','lower left',pad=0,color='#00FF007F',frameon=False,size_vertical=.1,label_top=True)expected_scalebar.size_bar.get_children()[0].set_edgecolor("none")ref_scalebar=AnchoredSizeBar(bx.transData,.2,'','lower left',pad=0,color='#FF0000',frameon=False,size_vertical=0,label_top=True)bx.add_artist(ref_scalebar)bx.add_artist(expected_scalebar)#fig.savefig("bug.png")#fig.savefig("bug.svg")
Easier to see in vector format but svg are not allowed
bug.pdf
On the first subplot, the current sizebar with size_vertical is drawn in red. As the facecolor is the same as the edgecolor the actual Rectangle is longer than it should be.
On the bottom subplot, the sizebar without size_vertical is drawn in red and the expected one with size_vertical in green.
A quick workaround is currently to set the edgecolor to none if the rectangle is filled.
Matplotlib version
- Operating system: Win10
- Matplotlib version : 3.3.2