|
From: darkside <in....@gm...> - 2012-08-08 11:03:57
|
---------- Forwarded message ---------- From: darkside <in....@gm...> Date: 2012/8/2 Subject: Re: [Matplotlib-users] zoomed in detail box To: Jae-Joon Lee <lee...@gm...> Hi everyone! I'm also trying to do a detailed zoomed area of my plot, but I can't manage to put the box in the position I want, bbox_to_anchor didn't work in my case: axins = zoomed_inset_axes(ax,3,loc=2,bbox_to_anchor=(0,0,0.5,0.5),bbox_transform=ax.transAxes) This bbox_to_anchor tuple is just an example. I only want to move the zoomed box a little to the right, since the ticklabels overlap. Any idea? I really appreciate your help! 2009/7/10 Jae-Joon Lee <lee...@gm...> > On Thu, Jul 9, 2009 at 7:24 AM, Robin<ro...@gm...> wrote: > >> On Wed, Jul 8, 2009 at 10:57 PM, Jae-Joon Lee<lee...@gm...> > wrote: > >>> If you use the svn version of matplotlib, you may use axes_grid > toolkit. > >>> > >>> > http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#insetlocator > > > > Wow - this is really amazing. Sometimes it can be a bit frustrating > > when I'm working to a deadline to figure out the details of Bbox's and > > such but when I find something like this it really makes it worth > > while! It does exactly what I want, really easy to use and only took > > about 5 lines! (It would be nice if there were some docstrings in > > there though :)) > > > > On Thu, Jul 9, 2009 at 4:02 AM, Jae-Joon Lee<lee...@gm...> > wrote: > >> However, It is possible to specify the location of the axes in > >> normalized axes coordinate. > >> > >> http://thread.gmane.org/gmane.comp.python.matplotlib.general/16373 > > > > I'm afraid I didn't really understand how to apply this in my case... > > I guess I would have to set the position and everything by hand > > instead of using the zoom helper. I preferred to use the zoom helper, > > but found the legend loc settings put it slightly too close to the > > edge of the surrounding axes for my taste. > > > > So after checking the docstrings for how to position legends I came up > > with something that works, but it required a minor change to the > > inset_locator.py to pass the bbox_to_anchor and bbox_transform (it > > looks like this was intended since they have None default values): > > > > robin-mbp-3:~ robince$ diff > > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mpl_toolkits/axes_grid/inset_locator.py > > code/scipy_build/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py > > 288c288 > > < axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, > > loc=loc, bbox_to_anchor=bbox_to_anchor,bbox_transform=bbox_transform) > > --- > >> axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc) > > > > With this minor change I get exactly what I want! > > > > Thanks for the catch. I'll commit the change to the svn soon. > By the way, borderpad keyword is meant to do what you want. However, I > just found that it does not work sine the option is not properly > handled. I'll fix this in the next commit. > > Regards, > > -JJ > > > > ax1ins = zoomed_inset_axes(ax1, 3, > > bbox_to_anchor=(0.1,0,1,1),bbox_transform=ax1.transAxes, loc=6) > > plot_trial_dists(res515[0],8,ax=ax1ins) > > ax1ins.set_xlim([5, 50]) > > ax1ins.set_ylim([0, 0.04]) > > ax1ins.set_xticks([]) > > ax1ins.set_yticks([]) > > mark_inset(ax1, ax1ins, loc1=2, loc2=4, fc="none", ec="0.5") > > > > thanks again, this is really terrific! > > > > Cheers > > > > Robin > > > > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |