Here is the axes_grid1 version. I only attach the *axins* part.
It is not identical to your original example and have difference scales.

-JJ

ax1 = ax[ybins-1,1]

from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, \
     mark_inset

axins = zoomed_inset_axes(parent_axes=ax1, zoom=2, loc=8,
                          bbox_to_anchor=(0.5, 0.),
                          bbox_transform=ax1.transAxes,
                          axes_kwargs=dict(sharex=ax1, sharey=ax1),
                          borderpad=-1.5, #padding in fraction of font size
                          )

pp, p1, p2 = mark_inset(parent_axes=ax1, inset_axes=axins, loc1=3, loc2=4.,
                        linestyle="dotted")
pp.set_visible(False)

axins.axesPatch.set_alpha(0.)

# we want to draw the bottom spine only
axins.set_frame_on(True)
axins.spines['top'].set_visible(False)
axins.spines['left'].set_visible(False)
axins.spines['right'].set_visible(False)

# don't draw the y axis ticks or labels
axins.set_yticks([])
axins.set_yticklabels([])

# only draw the bottom (x) axes
axins.xaxis.set_ticks_position('bottom')
axins.xaxis.set_label_position('bottom')

axins.set_xlabel('z-coordinate')


On Mon, Jan 31, 2011 at 2:08 AM, Benjamin Root <ben.r...@ou.edu> wrote:
> On Monday, January 24, 2011, johanngoetz <jgo...@ucla.edu> wrote:
>>
>> Hello,
>> A common task I have is to histogram one variable of a multidimensional
>> dataset as a function of two (or more) variables. I have attached an example
>> which shows exactly what I would like to do.
>>
>> The problem I would like to solve is the zoomed in x-axis which is the last
>> part of the script attached. I start by copying one of the subplots with
>> Axes.twiny() and proceed to adjust it and label it. The results are quite
>> nice but as soon as I start adjusting the plotted window or any of the
>> subplot spacing parameters, this "copy of an axis" does not transform
>> properly. Could anyone make a suggestion as to which transformations I
>> should use to shift and zoom the new axes? Or perhaps there is a better
>> method for drawing a zoomed in version of an axis?
>>
>> I would like to submit this to the examples/gallery page but feel that these
>> details need to be addressed, and I am not sure I know how to fix them.
>> Hopefully, I have commented this example enough that someone could follow
>> what I am doing.
>>
>> Thank you,
>> Johann
>>
>> http://old.nabble.com/file/p30748088/grid_plot.png
>>
>> http://old.nabble.com/file/p30748088/grid_plot.py grid_plot.py
>>
>>
>> --
>> View this message in context: 
>> http://old.nabble.com/zoomed-copy-of-axis-for-grid-of-subplots-tp30748088p30748088.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
>> Finally, a world-class log management solution at an even better price-free!
>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
>> February 28th, so secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsight-sfd2d
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> Have you checked out the axes_grid1 toolkit?  I have seen some neat
> features there such as zoomed in plots and such.  Maybe it could help
> you?
>
> Ben Root
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to