<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 29, 2014 at 1:41 PM, Fernando Perez <span dir="ltr"><<a href="mailto:fperez.net@gmail.com" target="_blank">fperez.net@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class=""><br>
<div class="gmail_quote">On Tue, Jul 29, 2014 at 1:06 PM, Antonino Ingargiola <span dir="ltr"><<a href="mailto:tritemio@gmail.com" target="_blank">tritemio@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Just my 2c: why don't providing an API function like "show_figure(False)". At this moment it will just call close(). In the future if you change implementation the API function will stay the same. </blockquote>
</div><br></div>Not a bad idea... I'd like to mull a little bit on the cleanest way to do this, but that's not a bad solution.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If nothing else, you can add that to your local utils for now, and see if it works well enough.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">def showfig(f):</div><div class="gmail_extra"> plt.close(f)</div><div class="gmail_extra"> display(f)</div><div class="gmail_extra"><br></div><div class="gmail_extra">
is easy enough to add at the top :)</div></div></blockquote><div><br></div><div>Yep, I'm doing also a step further. Since the problem was adding interactivity to inline matplotlib plots, I wrapped the necessary bits in a function like this:</div>
<div><br></div><div><div>def add_cursor(fig, ax):</div><div> plt.close()</div><div><br></div><div> vline = ax.axvline(1, color='k')</div><div> hline = ax.axhline(1, color='k')</div><div><br></div>
<div> def set_cursor(x, y):</div><div> vline.set_xdata((x, x))</div><div> hline.set_ydata((y, y))</div><div> display(fig)</div><div> </div><div> interact(set_cursor, x=ax.get_xlim(), y=ax.get_ylim())</div>
</div><div><br></div><div>and then simply add a call to add_cursor whenever is needed. In this case display() is called by interact(). I will probably write a couple of similar functions for various "interactivity needs".</div>
<div><br></div><div>Thanks again,</div><div>Antonio</div></div></div></div>