On 01/23/2011 11:46 PM, Paul Ivanov wrote:
[...]
> Done in r8935, see examples/pylab_examples/broken_axis.py
>

Thank you.

> I documented the above, used deterministic fake data, as Eric
> suggested, and added the diagonal cut lines that usually
> accompany a broken axis. Here's the tail end of the script which
> creates that effect (see updated attached image).

Beautiful!

Eric

>
>    # This looks pretty good, and was fairly painless, but you can
>    # get that cut-out diagonal lines look with just a bit more
>    # work. The important thing to know here is that in axes
>    # coordinates, which are always between 0-1, spine endpoints
>    # are at these locations (0,0), (0,1), (1,0), and (1,1).  Thus,
>    # we just need to put the diagonals in the appropriate corners
>    # of each of our axes, and so long as we use the right
>    # transform and disable clipping.
>
>    d = .015 # how big to make the diagonal lines in axes coordinates
>    # arguments to pass plot, just so we don't keep repeating them
>    kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
>    ax.plot((-d,+d),(-d,+d), **kwargs)      # top-left diagonal
>    ax.plot((1-d,1+d),(-d,+d), **kwargs)    # top-right diagonal
>
>    kwargs.update(transform=ax2.transAxes)  # switch to the bottom axes
>    ax2.plot((-d,+d),(1-d,1+d), **kwargs)   # bottom-left diagonal
>    ax2.plot((1-d,1+d),(1-d,1+d), **kwargs) # bottom-right diagonal
>
>    # What's cool about this is that now if we vary the distance
>    # between ax and ax2 via f.subplots_adjust(hspace=...) or
>    # plt.subplot_tool(), the diagonal lines will move accordingly,
>    # and stay right at the tips of the spines they are 'breaking'
>
> best,

------------------------------------------------------------------------------
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