From: Paul H. <pmh...@gm...> - 2014-03-25 16:30:13
|
Wow. Thanks so much, Stan! This is a huge help and works just as I need it to. Much appreciated! On Mon, Mar 24, 2014 at 11:26 AM, Stan West <sta...@nr...> wrote: > On 2014-03-24 14:08, Stan West wrote: > > May I suggest that you look at the mailing list thread from that time [1], > try the patch in the thread, and see whether your issue is resolved? This > solution doesn't provide a work-around in your code, but it may fix the > problem at the root. > > Paul, I just found the work-around that I used in my code. Define the > following function: > > def set_spine_position(spine, position): > """ > Set the spine's position without resetting an associated axis. > > As of matplotlib v. 1.0.0, if a spine has an associated axis, then > spine.set_position() calls axis.cla(), which resets locators, formatters, > etc. We temporarily replace that call with axis.reset_ticks(), which is > sufficient for our purposes. > """ > axis = spine.axis > if axis is not None: > cla = axis.cla > axis.cla = axis.reset_ticks > spine.set_position(position) > if axis is not None: > axis.cla = cla > > (The mention of v. 1.0.0 in the docstring is just the version I was using > at the time, not necessarily the earliest version with this issue.) Then > replace method calls like "spine.set_position(pos)" with the function call > "set_spine_position(spine, pos)". I hope this helps. > |