Maptlotlib: add zoomed region of a graph with anisotropic (axis dependent) zoom
Question: I'm trying to get a plot done using `Python.matplotlib` in which I would add
to a first plot a zoomed region in a box located in the lower right corner.

Looking at documentation and examples, I know that this is usually done using
`zoomed_inset_axes` but it seems to only take one factor for zooming/dilating
for both directions ![enter image description
here](http://i.stack.imgur.com/duU3u.png)when I'd like to dilate only along
the y axis (looking at the attached picture it is easy to guess why). So I
tried to give a bbox scaled as I would like but it doesn't seem to do the
trick. Is there an axis transformation or a data operation that could help me?

The red arrows and box described the size I would like my box to take (more or
less, I'll tune later of course).

Edit:

I've been playing with it a bit more and my problem seems to be that the two
graphs, in the current state, do share the same y-axis scale.

Here is my code, by the way, should have been included in the first place:

    
    
    ax = plt.gca()
    axins = zoomed_inset_axes(ax, 1, loc=4)
    axins.scatter(x,y, lw=0.1,c="#1B9E77",alpha=0.8)
    x1, x2, y1, y2 = -75, 5200, -0.31, -0.18 #coordinates of the region I'm zooming in
    axins.plot(N.linspace(x1,x2,100),[-0.25]*100,c="#EFD807",lw=3) #yellow line
    
    axins.set_xlim(x1, x2)
    axins.set_ylim(y1, y2)
    mark_inset(ax, axins, loc1=3, loc2=1, fc="none", ec="0.5")
    


Answer: An alternative method to `zoomed_inset_axes` is to do it 'manually'. I'm sure
there are short comings to this method so if people know of them please
comment. I by no means am suggesting this is the best method - just one I've
seen about.

    
    
    import matplotlib.pyplot as plt
    import numpy as np
    
    x = np.linspace(0, 100, 1000)
    y = np.sin(x)
    
    ax = plt.subplot(111)
    ax.plot(x, y)
    ax.set_ylim(-50, 10)
    
    ax2 = plt.axes([0.2, 0.2, .6, .2])
    ax2.plot(x, y)
    
    mark_inset(ax, ax2, loc1=2, loc2=1, fc="none", ec="0.5")
    
    plt.show()
    

![enter image description here](http://i.stack.imgur.com/vGNlI.png)

This answer is adapted from [this
original](http://stackoverflow.com/questions/13583153/how-to-zoomed-a-portion-
of-image-and-insert-in-the-same-plot-in-matplotlib) SO post.

An altenative method is proposed in [this
SO](http://stackoverflow.com/questions/24035118/different-x-and-y-scale-in-
zoomed-inset-matplotlib) post.

