How to integrated plt.fill with event handling

Hi

I am trying to integrate plt.fill() function of matplotlib in GUI by using event handling (http://matplotlib.org/users/event_handling.html). The aim is to connect the Matplotlib event to a callback function and then display plots.

I would appreciate any ideas.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160428/a90e86a5/attachment.html>

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.

At the risk of boasting, I would highly recommend reading my book:
http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/
as it is probably the most comprehensive set of documentation regarding the
interactive features of matplotlib.

Let us know if you have any questions.

Ben Root

On Thu, Apr 28, 2016 at 3:59 AM, Said Bashir <smsawmu at hotmail.com> wrote:

Hi

I am trying to integrate plt.fill() function of matplotlib in GUI by using
event handling (http://matplotlib.org/users/event_handling.html). The aim
is to connect the Matplotlib event to a callback function and then display
plots.

I would appreciate any ideas.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160428/c92b813b/attachment.html>

Hi Ben,

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.

Juan

Reply: Benjamin Root <ben.v.root at gmail.com> <ben.v.root at gmail.com>

···

From: Benjamin Root <ben.v.root at gmail.com> <ben.v.root@gmail.com>
Date: 29 April 2016 at 5:29:45 AM
To: Said Bashir <smsawmu at hotmail.com> <smsawmu at hotmail.com>
CC: matplotlib-users at python.org <matplotlib-users at python.org>
<matplotlib-users at python.org>
Subject: Re: [Matplotlib-users] How to integrated plt.fill with event
handling

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.

At the risk of boasting, I would highly recommend reading my book:
http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/
as it is probably the most comprehensive set of documentation regarding the
interactive features of matplotlib.

Let us know if you have any questions.

Ben Root

On Thu, Apr 28, 2016 at 3:59 AM, Said Bashir <smsawmu at hotmail.com> wrote:

Hi

I am trying to integrate plt.fill() function of matplotlib in GUI by
using event handling (http://matplotlib.org/users/event_handling.html). The
aim is to connect the Matplotlib event to a callback function and then
display plots.

I would appreciate any ideas.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160428/afed0396/attachment.html>

Hi all

Thank you for the advice.

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.

def my_plot(self, nap):

        self.fig = plt.figure()

        self.ax = self.fig.add_subplot(121)

        self.connectMplEvents(self.fig)

def connectMplEvents(self, figure):

       figure.canvas.mpl_connect('button_press_event', press)

       figure.canvas.mpl_connect('button_release_event', release)

       figure.canvas.mpl_connect('key_press_event', keypress)

       figure.canvas.mpl_connect('key_release_event', keyup)

       figure.canvas.mpl_connect('motion_notify_event', motionnotify)

         ......

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

Said

···

________________________________
From: Juan Nunez-Iglesias <jni.soma@gmail.com>
Sent: 28 April 2016 22:03
To: Benjamin Root; Said Bashir
Cc: matplotlib-users at python.org
Subject: Re: [Matplotlib-users] How to integrated plt.fill with event handling

Hi Ben,

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.

Juan

From: Benjamin Root <ben.v.root at gmail.com><mailto:ben.v.root@gmail.com>
Reply: Benjamin Root <ben.v.root at gmail.com><mailto:ben.v.root at gmail.com>
Date: 29 April 2016 at 5:29:45 AM
To: Said Bashir <smsawmu at hotmail.com><mailto:smsawmu at hotmail.com>
CC: matplotlib-users at python.org<mailto:matplotlib-users at python.org> <matplotlib-users at python.org><mailto:matplotlib-users at python.org>
Subject: Re: [Matplotlib-users] How to integrated plt.fill with event handling

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.

At the risk of boasting, I would highly recommend reading my book: http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/ as it is probably the most comprehensive set of documentation regarding the interactive features of matplotlib.

Let us know if you have any questions.

Ben Root

On Thu, Apr 28, 2016 at 3:59 AM, Said Bashir <smsawmu at hotmail.com<mailto:smsawmu at hotmail.com>> wrote:

Hi

I am trying to integrate plt.fill() function of matplotlib in GUI by using event handling (http://matplotlib.org/users/event_handling.html). The aim is to connect the Matplotlib event to a callback function and then display plots.

I would appreciate any ideas.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org<mailto:Matplotlib-users at python.org>
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org<mailto:Matplotlib-users at python.org>
https://mail.python.org/mailman/listinfo/matplotlib-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160429/94f870da/attachment-0001.html>

Chapter 2 - Page 38: "Picking"

http://matplotlib.org/users/event_handling.html#object-picking

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.

Cheers!
Ben Root

On Fri, Apr 29, 2016 at 4:33 AM, Said Bashir <smsawmu at hotmail.com> wrote:

Hi all

Thank you for the advice.

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.

def my_plot(self, nap):

        self.fig = plt.figure()

        self.ax = self.fig.add_subplot(121)

        self.connectMplEvents(self.fig)

def connectMplEvents(self, figure):

       figure.canvas.mpl_connect('button_press_event', press)

       figure.canvas.mpl_connect('button_release_event', release)

       figure.canvas.mpl_connect('key_press_event', keypress)

       figure.canvas.mpl_connect('key_release_event', keyup)

       figure.canvas.mpl_connect('motion_notify_event', motionnotify)

         ......

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

Said

------------------------------
*From:* Juan Nunez-Iglesias <jni.soma at gmail.com>
*Sent:* 28 April 2016 22:03
*To:* Benjamin Root; Said Bashir
*Cc:* matplotlib-users at python.org

*Subject:* Re: [Matplotlib-users] How to integrated plt.fill with event
handling

Hi Ben,

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.

Juan

From: Benjamin Root <ben.v.root at gmail.com> <ben.v.root at gmail.com>
Reply: Benjamin Root <ben.v.root at gmail.com> <ben.v.root at gmail.com>
Date: 29 April 2016 at 5:29:45 AM
To: Said Bashir <smsawmu at hotmail.com> <smsawmu at hotmail.com>
CC: matplotlib-users at python.org <matplotlib-users at python.org>
<matplotlib-users at python.org>
Subject: Re: [Matplotlib-users] How to integrated plt.fill with event
handling

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.

At the risk of boasting, I would highly recommend reading my book:
http://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843/
as it is probably the most comprehensive set of documentation regarding the
interactive features of matplotlib.

Let us know if you have any questions.

Ben Root

On Thu, Apr 28, 2016 at 3:59 AM, Said Bashir <smsawmu at hotmail.com> wrote:

Hi

I am trying to integrate plt.fill() function of matplotlib in GUI by
using event handling (http://matplotlib.org/users/event_handling.html). The
aim is to connect the Matplotlib event to a callback function and then
display plots.

I would appreciate any ideas.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160429/ab90f054/attachment.html>