On Wednesday, November 01, 2006, at 02:17PM, "John Hunter" <[EMAIL PROTECTED]> wrote: >>>>>> "listservs" == listservs <[EMAIL PROTECTED]> writes: > > listservs> I am trying to produce a series of histograms of > listservs> related data, for which I want the ranges and scales of > listservs> the x-axes to be the same. However, I dont see an > listservs> obvious way of doing this with hist, since specifying > listservs> nbins will not guarantee the same axis for each. Is > listservs> there some sort of hack that I can use to do this (or > listservs> an argument I am overlooking?). > > >You can force axes in the same figure to share the same xaxes > >ax1 = subplot(211) >ax2 = subplot(212, sharex=ax1) > >then any changes (panning and zooming) in one will be instantaneously >reflected in the other. > >For axes in different figures, you can set the xlim manually > >ax1.set_xlim(xmin, xmax) >ax2.set_xlim(xmin, xmax) >
Thanks John, I think I almost have it, but not quite. Say the first dataset is in the range 2-4, and the second is in the range 1-3. At the moment, I am doing as you say, and what happens is that the x axis gets defined by the first plot, and given to the second with the sharex argument. However, this ends up giving the second plot a range of 2-4, so much of the data (from 1-2) is not shown. What I need is for the axes of _both_ plots to be expanded to the range 1-4. C. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users