<div dir="ltr"><div><div><div>Chapter 2 - Page 38: "Picking"<br><br><a href="http://matplotlib.org/users/event_handling.html#object-picking">http://matplotlib.org/users/event_handling.html#object-picking</a><br><br></div>Do keep in mind that an artist object can only be in one place (subplot/figure/etc.). So, to draw it into a designated frame, you will need to remake the artist within the callback. I don't know if you already realized that or not, but it is something that has tripped up users before.<br><br></div>Cheers!<br></div>Ben Root<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 4:33 AM, Said Bashir <span dir="ltr"><<a href="mailto:smsawmu@hotmail.com" target="_blank">smsawmu@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all</p>
<p><br>
</p>
<p><font face="Times New Roman"></font></p>
<p style="margin:0cm 0cm 8pt"><font face="Calibri">Thank you for the advice. </font>
</p>
<p style="margin:0cm 0cm 8pt"><font face="Calibri">To give you bit of a background: I am working with Kivy GUI framework and I am trying to embed figures into GUI. At the moment I successfully managed to embed the figures when I used plt.figure() as shown
 below example.</font></p>
<p style="margin:0cm 0cm 8pt"><font face="Consolas" size="2"><font face="Consolas" size="2"></font></font></p>
<p>def my_plot(self, nap):</p>
<p>        self.fig = plt.figure()</p>
<p>        <a href="http://self.ax" target="_blank">self.ax</a> = self.fig.add_subplot(121)</p>
<p>        self.connectMplEvents(self.fig)</p>
<p>                </p>
<p>               </p>
<p><br>
</p>
<p>def connectMplEvents(self, figure):</p>
<p></p>
<p>       figure.canvas.mpl_connect('button_press_event', press)</p>
<p>       figure.canvas.mpl_connect('button_release_event', release)</p>
<p>       figure.canvas.mpl_connect('key_press_event', keypress)</p>
<p>       figure.canvas.mpl_connect('key_release_event', keyup)</p>
<p>       figure.canvas.mpl_connect('motion_notify_event', motionnotify)</p>
<p>         ...... </p>

<p></p>
<font face="Times New Roman"></font><font face="Times New Roman"></font>
<p style="margin:0cm 0cm 8pt"><font face="Calibri">I would like similar concept that would bind the filled area into a callback so it could be plotted into a designated frame (e.g. subplot(122))</font></p>
<p style="margin:0cm 0cm 8pt">Said</p>
<font face="Times New Roman"></font><br>
<p></p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="width:98%;display:inline-block">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Juan Nunez-Iglesias <<a href="mailto:jni.soma@gmail.com" target="_blank">jni.soma@gmail.com</a>><br>
<b>Sent:</b> 28 April 2016 22:03<br>
<b>To:</b> Benjamin Root; Said Bashir<br>
<b>Cc:</b> <a href="mailto:matplotlib-users@python.org" target="_blank">matplotlib-users@python.org</a><div><div class="h5"><br>
<b>Subject:</b> Re: [Matplotlib-users] How to integrated plt.fill with event handling</div></div></font>
<div> </div>
</div><div><div class="h5">
<div>Hi Ben,
<div><br>
</div>
<div>Book looks very interesting, I'll check it out! But, in the meantime, I would guess that Said wants to bind a callback to clicking on the filled area. </div>
<div><br>
</div>
<div>Juan<br>
<br>
<div class="gmail_quote" style="color:black"><br>
From: <span style="color:black">Benjamin Root</span> <a href="mailto:ben.v.root@gmail.com" target="_blank">
<ben.v.root@gmail.com></a><br>
Reply: <span style="color:black">Benjamin Root</span> <a href="mailto:ben.v.root@gmail.com" target="_blank">
<ben.v.root@gmail.com></a><br>
Date: <span style="color:black">29 April 2016 at 5:29:45 AM</span><br>
To: <span style="color:black">Said Bashir</span> <a href="mailto:smsawmu@hotmail.com" target="_blank">
<smsawmu@hotmail.com></a><br>
CC: <span style="color:black"><a href="mailto:matplotlib-users@python.org" target="_blank">matplotlib-users@python.org</a></span>
<a href="mailto:matplotlib-users@python.org" target="_blank"><matplotlib-users@python.org></a><br>
Subject: <span style="color:black"> Re: [Matplotlib-users] How to integrated plt.fill with event handling
<br>
</span></div>
<br>
<blockquote class="gmail_quote" type="cite"><span>
<div>
<div></div>
<div>
<div dir="ltr">
<div>
<div>
<div>We would need a lot more information than that. There is no "plt.fill()" event, so I am not sure what you are trying to do.<br>
<br>
</div>
At the risk of boasting, I would highly recommend reading my book: <a title="http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/
Ctrl+Click or tap to follow the link" href="http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/" target="_blank">
http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/</a> as it is probably the most comprehensive set of documentation regarding the interactive features of matplotlib.<br>
<br>
</div>
Let us know if you have any questions.<br>
<br>
</div>
Ben Root<br>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Apr 28, 2016 at 3:59 AM, Said Bashir <span dir="ltr">
<<a href="mailto:smsawmu@hotmail.com" target="_blank">smsawmu@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
<div dir="ltr">
<div style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;background-color:rgb(255,255,255)">
<p><font face="Times New Roman"></font></p>
<p style="margin:0cm 0cm 8pt"><font face="Calibri">Hi</font></p>
<font face="Times New Roman"></font>
<p style="margin:0cm 0cm 8pt"><font face="Calibri">I am trying to integrate plt.fill() function of matplotlib in GUI by using event handling (</font><span style="background:white;line-height:107%;font-family:Consolas;font-size:9.5pt"><a href="http://matplotlib.org/users/event_handling.html" target="_blank"><font color="#0563c1">http://matplotlib.org/users/event_handling.html</font></a><span style="color:green">)</span></span><span style="color:green;line-height:107%;font-family:Consolas;font-size:9.5pt">.</span>
<span style="line-height:107%;font-family:Consolas;font-size:9.5pt">The aim is to connect the Matplotlib event to a callback function and then display plots.</span></p>
<font face="Times New Roman"></font>
<p style="margin:0cm 0cm 8pt"><span style="line-height:107%;font-family:Consolas;font-size:9.5pt">I would appreciate any ideas.</span></p>
<font face="Times New Roman"></font><br>
<p></p>
</div>
</div>
<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
<br>
</blockquote>
</div>
<br>
</div>
_______________________________________________ <br>
Matplotlib-users mailing list <br>
<a href="mailto:Matplotlib-users@python.org" target="_blank">Matplotlib-users@python.org</a> <br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a>
<br>
</div>
</div>
</span></blockquote>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div>