Thanks for putting together a simple example of the problem - it really makes the investigation easier!
Is there a solution to this problem?
Yes, it turns out! My initial hunch, just looking at the image you attached, was that there is a strange crop / click. After eliminating the possibility of anti-aliasing (by clicking the switch that you provided), my only alternative to testing was to set the keyword "binding" to false (for very limited documents using the binding method, see http://matplotlib.org/api/ artist_api.html # matplotlib.artist.Artist.set_snap ).
Setting up the binding does the trick, and you get the expected results:
import matplotlib.pyplot as plt import matplotlib.patches as patches ax = plt.axes() for x in range(-10,11): for y in range(-10,11): rect = patches.Rectangle((x, y), width=0.1, height=0.1, color='k', snap=False) ax.add_patch(rect) plt.xlim([-30, 30]) plt.ylim([-30, 30]) plt.show()
Visual comparison (perhaps the best opening of the image in a new window, since your browser probably scales the image and introduces additional visual effects):

I am not very well versed in the snap object in mpl and is it really desirable, so I will post the question to the mpl-devel mailing list to open a conversation about this issue. Hope this answer helps you at the same time.
pelson
source share