Hi, I was shown a bug today by a colleague, demonstrated by the following example:
import numpy as np import matplotlib.pyplot as plt a = np.zeros([10, 10]) a[2:6,3:8] = 1 ls = plt.contour(a, 1, colors='r', linewidths=3, zorder=5) print ls.collections[0]l.get_zorder() rect = plt.Rectangle([2, 3], 5, 4, zorder=3) plt.gca().add_artist(rect) plt.show() Unless I completely misunderstand zorder, the contour should be *on top* of the rectangle. Also note that printing the zorder for the contour's collection (a LineCollection object) gives a value of 2, even though the call to contour() specified 5 for the zorder. Looking over the code for contour, the zorder is never mentioned. The reason the LineCollection ends up with a value of 2 is that this is the default for a LineCollection. My question is: is there any reason *not* to use the passed in zorder for contours/filled contours? If this is the proper fix, I'll check it in myself, I just wanted to make sure I'm not missing some special case here. As an aside, this is yet another example where it would be nice to know that a keyword argument was not being used. If there's no objections, I'd be willing to change ContourSet to pop arguments off of **kwargs so that it can see if some aren't used and throw an exception if not all are used. On the other hand, this could break existing code that are passing extra/useless kwargs, so maybe a warning would be better? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel