Diwaker Gupta wrote: >> Examples: >> >> This makes a sensible plot that behaves well under zooming and panning: >> hist(randn(1000), log=True) >> show() > > Thanks! However... > >> The following still generates an exception: >> hist(randn(1000)) >> gca().set_yscale('log') >> show() > > I think this makes the API more confusing. As an end user, I want the > API to be consistent and intuitive. Its weird if I can set log scale > after all plot commands, but not after calling hist. And yet, log > scale DOES work with that keyword arg. I might even think things were > broken had I not been following this thread. > > Anyways, thanks for looking into this!
I agree that it is not optimal, but I have not figured out any simple way of making bar (which is the underlying plot command) do the right thing without knowing beforehand whether it is dealing with a log or a linear axis. It simply has to make different choices for the patch (rectangle) corners and the data limits that are used for autoscaling. For this to work correctly in an interactive mode with set_yscale('log') called after the hist or bar command would require a mechanism for undoing and then redoing the hist or bar command. Such a mechanism could be developed, but it would require some structural changes in mpl (or maybe some very ugly hacks), and I don't see that this particular problem is bad enough to motivate such changes. Actually, I think the sticking point is the autoscaling, not the patches. For the default "bottom=None" case, we could set bottom to 1e-100 for both the log and linear axes, and for all practical purposes it would work correctly for either, indistinguishably from the way it does now. The problem is that with a linear axis we want the axis to start at zero by default, but with a log axis we want it to start a bit below the lowest bar, so the autoscaling is inherently different and needs to be based on a different dataLim bounding box. Maybe in time we will figure out better solutions. Eric ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users