From: Baptiste C. <bap...@al...> - 2005-01-30 23:13:52
|
John Hunter a =E9crit : > I have added some changes to CVS to support sharex and sharey kwargs > (I thought this was a better name than twinx and twiny). I had to > make some minor changes to axis to support sharing tick locators and > formatters, but nothing substantial. You can now instantiate an axes > with, eg >=20 > subplot(212, sharex=3Dax1) >=20 > and ditto for sharey. The view limits, transform function, and tick > Locator and Formatter are shared. This allows you to pan and zoom on > one axes and have the others follow, which is very nice. There is a > new example showing how to use this example/shared_axis_demo.py. >=20 Hi John, I like this implementation a lot. Cool stuff ! > I was able to remove the TwinAxes class altogether and use the shared > kwargs in its stead, which is cleaner. I preserved the "twin" > convenience function (naming it twinx) and all it does is pass the > proper kwargs and make the calls to tick_right. > examples/two_scales.py is updated >=20 you also need to call tick_left on the original axis, but that is a=20 minor correction. > I don't think the datalim need to be shared because they are > responsible only for autoscaling. > There is still a problem because autoscaling is disabled on the second=20 axes. I have an idea on how to solve this, I'll try it and send a patch=20 later in the week. > One possibility is to leave inaxes, xdata and ydata alone which > satisfies both problems above. And then to add a new attribute, axseq > which is a list of (ax, xdata, ydata ) tuples to handle the > overlapping axes case. Internally, we could use axseq so that pan/zoom > will be handled properly in the two_scales case. The draw back here > is that having more than one obvious way to do it may also confuse > people down the road. >=20 This sounds reasonable to me. I don't think it is confusing. If people=20 know what to do with multiple axes, they'll go with axseq, if not=20 inaxes, xdata and ydata will provide the most reasonable choice for them. I'll play a little bit with this, and see if it breaks anything I use. Cheers, BC |