Your code works as expected in my side.
So, changing (0.5, 0.5) to something like  (0.6, 0.5) has no effect in
your side?
Hmm, what is you matplotlib version? Maybe this is a bug in old
version of matplotlib.

Regards,

-JJ


On Wed, Sep 12, 2012 at 6:16 PM, darkside <in.the.darks...@gmail.com> wrote:
> Thank you for your help.
>
> A simple example that doesn't work for me is:
> ----------------------------------------
> import pylab as p
> import numpy as np
> from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes
> from mpl_toolkits.axes_grid.inset_locator import mark_inset
> from mpl_toolkits.axes_grid.anchored_artists import AnchoredSizeBar
> from matplotlib.ticker import MaxNLocator
>
> fig = p.figure(figsize=(12,8))
> ax = p.subplot(111)
>
> z = p.arange(0,1.415,0.01)
> d = z**2+np.random.random(len(z))
>
> ax.plot(z,d,'ro',label='text')
>
> p.xlabel('z',fontsize=18)
> p.ylabel('Luminosity distance',fontsize=18)
> p.grid(True)
>
> axins = zoomed_inset_axes(ax,
> 3,bbox_to_anchor=(0.5,0.5),bbox_transform=ax.figure.transFigure, loc=2)
>
>
> axins.plot(z,d,'r.')
>
> ax.legend(loc=2,bbox_to_anchor=(1,1))
>
> x,y = (0.86,1.3)
> x2,y2 = (1,1.7)
> axins.set_xlim(x,x2)
> axins.set_ylim(y,y2)
> axins.tick_params(axis='both',labelsize=12)
> axins.xaxis.set_major_locator(MaxNLocator(2))
> axins.yaxis.set_major_locator(MaxNLocator(3))
>
> mark_inset(ax,axins,loc1=1,loc2=3, fc="none", ec="0.5")
>
> p.draw()
> p.show()
> -----------------------------------------------------------
> The "bbox_to_anchor" label is supposed to move the zoomed axis, but it does
> nothing, no matter what two numbers I place there.
> I guess that I miss something, but I can't figure out what. I really
> appreciate your help.
>
> Best regards,
> Illa
>
>
>
> 2012/9/5 Jae-Joon Lee <lee.j.j...@gmail.com>
>>
>> On Mon, Aug 20, 2012 at 10:50 PM, darkside <in.the.darks...@gmail.com>
>> wrote:
>> > I am using zoomed_inset_axes, but the default position overlaps the
>> > yticks
>> > and the parent axe ticks, so I am trying:
>> > axins = zoomed_inset_axes(ax,
>> > 3,bbox_to_anchor(0.5,1),bbox_transform=ax.figure.transFigure, loc=2)
>>
>> This is supposed to work, and my quick test did work. Can you post a
>> complete but simple exampl?
>>
>> Regards,
>>
>> -JJ
>
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to