Re: [matplotlib-devel] autofmt_xdate() broken for twinx()
On Thu, Nov 18, 2010 at 8:58 AM, Scott Sinclair wrote: > Hi, > > It seems that the autofmt_xdate helper method is broken when twinx is > used. Consider the script below: > > - > import datetime as dt > > import numpy as np > import matplotlib.pyplot as plt > from matplotlib.dates import date2num > > strt = dt.datetime(2000, 3, 15, 6) > delta = dt.timedelta(hours=6) > date_list = [(strt + i*delta) for i in range(100)] > > x = date2num(date_list) > y = np.sin(x) > z = np.cos(x) > > fig, ax1 = plt.subplots() > > ax1.plot(date_list, y, 'b-') > > ax2 = ax1.twinx() > ax2.plot(date_list, z, 'r-') > > # using the auto format method doesn't work > fig.autofmt_xdate() > > plt.show() > - > > This is because the 'is_last_row' attribute isn't present on ax2 and > len(fig.axes) != 1 when the autofmt_xdate method is called on fig. > > The attached patch fixes it for me and still seems to give the > advertised behaviour for single and vertically stacked subplots. > > Cheers, > Scott > > I am not very familiar with this part of mpl, but your diff seems to cut out a few things. In particular, the original code checks to see if the figure has a single axes object or more. However, your code seems to cut this check out. Now, it may have been that the check could have been unnecessary, but I am not sure. I am curious as to your insight on this. In addition, the original code called "self.subplots_adjust(bottom=bottom)" only when all subplots were on the last row. Now, it seems that it is always called no matter what. Ben Root -- Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today http://p.sf.net/sfu/msIE9-sfdev2dev___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Bug in mplot3d contourf
On Mon, Nov 22, 2010 at 3:30 AM, Ian Thomas wrote: > I've found a bug in mplot3d's rendering of filled contours. Attached is a > simple test script to reproduce the error and an example of the output: the > 2D plot on the left shows the desired result, the 3D plot on the right shows > the holes in the contour are not rendered correctly. > > Digging around in axes3d.py and art3d.py, I think the problem is that > mplot3d ignores the 'codes' that are produced by the 2D contourf routine. I > am probably not using the correct terminology, but I understand that these > codes allow a polygon to be composed of multiple line loops, some of which > may be holes within other line loops. By ignoring the codes, the 3D routine > renders a single polygon by concatenating all the points together regardless > of whether they correspond to a hole or not. > > In revision 8806 of lib/mpl_toolkits/mplot3d/art3d.py, lines 136-7: > >for (((x, y), code), z) in zip(pathsegs, zs): > seg.append((x, y, z)) > > The codes are extracted from the pathsegs (which come from the 2D contourf > routine), but then ignored. > > I've taken a look at trying to fix this, but it was not obvious to me how > to propagate the 'codes' rendering functionality from the 2D to 3D source > code. Perhaps someone more familiar with mplot3d could look at it. > > Thanks, > Ian > > Confirmed. Ian, would you mind filing a bug report on this at mpl's tracker? http://sourceforge.net/tracker/?atid=560720&group_id=80706&func=browse Thank you very much for your insightful analysis as well. It will be helpful in finding a fix for this. Ben Root -- Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel