From: Andrew S. <str...@as...> - 2004-09-24 17:09:51
|
John Hunter wrote: >>>>>>"Alan" == Alan G Isaac <ai...@am...> writes: >>>>>> >>>>>> > > Alan> Now that you have given us axhline as a generalization of > Alan> gnuplot's set xzeroaxis please consider letting xticks take > Alan> an optional "loc" argument, which could either be "border" > Alan> or a number to be interpreted as a 'y' value. > > Alan> So, e.g., axhline() xticks(arange(5),loc=0) would draw an > Alan> xzeroaxis and put the xtics along it. > > > I tried your suggestion in gnuplot, and I found the results to be ugly -- the ticks straddled the axis line, rather than being inside or outside. But I see, in theory, what you mean. >However, there is a rub. Sometimes you probably want to place the >xaxes y location in data units, eg at y=0. Note that this is not the >same as y=0 in axes coords, which is always the bottom of the >rectangle. This is possible since matplotlib lets you specify the x >and y data in different data coordinate systems, eg with >http://matplotlib.sourceforge.net/matplotlib.transforms.html#-blend_xy_sep_transform, > > Hmm... that URL is not working for me, but I found what you referenced at http://matplotlib.sourceforge.net/matplotlib.transforms.html >but I think it would take some work to make the interface easy and >intuitive. The other trick, from the developer side, is to couple the >location of the ticks and tick labels to the y coord of the axes line. >Doable, certainly, but would require some redesign because currently >they all "know" their location. > > It seems using scipy's traits object for its ability to set observers on a variable may be useful here. As I said earlier, I may take a stab at this, but I always feel as if I'm "hacking in the dark" when I try and grasp matplotlib's transform and render model... When/if I look at this in greater detail, I'll surely let you know! :) If you're going to a new render model in the future (kiva?), I wonder how useful or long-term would any changes I made now be? Cheers! Andrew |