From: Jae-Joon L. <lee...@gm...> - 2009-06-30 17:21:48
|
Hi Fabrice, Good to hear that you were able to get it work. Here is some tweak on transforms. This way, the plot is shown correctly even if you change the y-limits of axes. trans0 = blended_transform_factory(ax0.transData, ax0.transAxes) trans1 = blended_transform_factory(ax1.transData, ax1.transAxes) bbox = Bbox.from_extents(xmin, 0, xmax, 1) mybbox1 = TransformedBbox(bbox, trans0) mybbox2 = TransformedBbox(bbox, trans1) I think the code is worth to be included as an mpl example. I'll push this into the svn if you don't mind. Regards, -JJ On Tue, Jun 30, 2009 at 8:12 AM, Fabrice Silva<si...@lm...> wrote: > Le lundi 29 juin 2009 à 16:11 -0400, Jae-Joon Lee a écrit : >> I think the issue here is to connect points in two different axes, >> which is possible but can be a bit difficult. > That was my problem > >> In the svn version of matplotlib, there are some helper classes to >> ease this job a bit. > Thanks for your pointer. Sadly the mpl.toolkits.axes_grid is not shipped > by debian package, and downloading it requires other stuff. So I adapted > from the inset_locator.py the attached file. > > Finally I can "zoom" with the mere script : > import matplotlib.pyplot as plt > from mpl_axes_grid_inset_locator import zoom_effect > S1 = plt.subplot(211) > S1.plot(... # xlim (0.,1.2) > S2 = plt.subplot(223) > S2.plot(... # xlim (0.0095,.012) > S3 = plt.subplot(224) > S3.plot(... # xlim (0.84,1.) > # Labels stuff > # [...] > > patch_props=dict(ec="r", alpha=0.5, fc="r") > zoom_effect(S1,S2, 0.01, 0.011, **patch_props) > zoom_effect(S1,S3, 0.90, 0.95, **patch_props) > > It produces two zoom subplots with the wanted patch. > > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |