Discussion:
[Matplotlib-users] Keep list of figures or plots and flip through list using UI
Thomas Caswell
2015-02-18 17:19:29 UTC
Permalink
Please ping the mailing list again (I cc'd the list on this).

See
https://github.com/tacaswell/leidenfrost/blob/master/leidenfrost/gui/reader_gui.py#L636
(sorry for the code quality, this is a bespoked gui I wrote as part of my
PhD work, you might be the second person to ever read this code) for a Qt
object that wraps up a `Figure` in a nice-embedded way. Using this
directly you can keep a list of these objects around and show/hide them
using standard Qt methods. Modifying this a bit you could make this class
based on a standard Qt widget, embed them all in a main window/what have
you and then again use standard Qt methods to show/hide individual plots as
you wish.

Tom
Sorry for digging this back up, but I can't seem to get this to work.
I looked at glue as you suggested, but the page says it only supports
python 2.7. As for the Qt examples I can find, all I see how to do is
to feed a single plot widget different data sets - but nothing on
dynamically changing the underlying widget and redrawing. Would you
maybe take a look at my code and tell me what it is I am missing? If
so, I'll send it to you.
Much appreciated.
-C
No problem - thanks for the reply. I tried your suggestion of keeping
a widget for each plot, but I couldn't get the main window to refresh
correctly - maybe I was doing something wrong. I'll give it another
try as soon as I get a chance. In the meantime, I'll check out glue
as well - it looks pretty cool.
I might bug you one more time if I can't figure it out, but I am not
in a hurry and I probably just overlooked something. :)
Thanks and much appreciated!
-C
Sorry this didn't get a response for so long.
The core of the embedding in Qt is at QWidget which contains the canvas.
Anything you want to do with a QWidget you can do with the canvas.
Independently you need to maintain the mpl level plotting objects (the
Figure, Axes, and Artist objects) (well, you don't _need_ to, you can
get to
them through the canvas object, but to keep your self sane I highly
recommend keeping track of the mpl objects your self, this linkage is
there
so that GUI generated draw commands can trigger a re-rendering of the
figure).
I would just have a widget for each of the plots you want to have and
then
cycle which one is visible in the main window, that is probably a lot
easier
than trying to attach and detach canvases from Figures.
I would also take a look at glue
http://www.glueviz.org/en/stable/installation.html who may have solved
many
of these problems for you.
Tom
Hi all,
I often have scripts that make a lot of plots, and I would like to be
able to create the plots and then have a UI tool that shows a list of
their titles, click on the title and have the plot be drawn in a
window. So far, I have been able to use PyQt to create a UI with a
list box and a Widget to display plots. What I can't seem to figure
out is how to make a bunch of plots and then have the Window update.
list of plots = []
plots.append(plot(dataset))
add plot title to UI list, position in list is reference back
into list of plots
click on plot name/title
widget draws plot
So - basically like docked plots, except there is just a list to the
side instead (much cleaner IMHO)
I haven't been able to find any examples from googling. Has any one
been able to do this or seen examples?
Any help or suggestions are appreciated!
Thanks!
------------------------------------------------------------
------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is
your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Thomas Caswell
2015-02-18 17:31:36 UTC
Permalink
A good tutorial on how to make mpl play nice with QtDesigner would be a
useful thing to have in the documentation. It would be appreciated if you
could take a crack at writing that up.

Tom

---------- Forwarded message ---------
From: tenspd137 . <***@gmail.com>
Date: Wed Feb 18 2015 at 12:25:10 PM
Subject: Re: [Matplotlib-users] Keep list of figures or plots and flip
through list using UI
To: Thomas Caswell <***@gmail.com>


Funny thing - shortly after I wrote you - I figured it out. I have a
GUI/Dialog I created with designer that has a push button which cycles
between two plots I stored in a list. If you would like to see my
code, I would be more than happy to share. It isn't fabulous, but it
show the mechanics. I will also take a look at what you just posted
above.

Much appreciated!

-C
Post by Thomas Caswell
Please ping the mailing list again (I cc'd the list on this).
See
https://github.com/tacaswell/leidenfrost/blob/master/
leidenfrost/gui/reader_gui.py#L636
Post by Thomas Caswell
(sorry for the code quality, this is a bespoked gui I wrote as part of my
PhD work, you might be the second person to ever read this code) for a Qt
object that wraps up a `Figure` in a nice-embedded way. Using this
directly
Post by Thomas Caswell
you can keep a list of these objects around and show/hide them using
standard Qt methods. Modifying this a bit you could make this class based
on a standard Qt widget, embed them all in a main window/what have you and
then again use standard Qt methods to show/hide individual plots as you
wish.
Tom
Sorry for digging this back up, but I can't seem to get this to work.
I looked at glue as you suggested, but the page says it only supports
python 2.7. As for the Qt examples I can find, all I see how to do is
to feed a single plot widget different data sets - but nothing on
dynamically changing the underlying widget and redrawing. Would you
maybe take a look at my code and tell me what it is I am missing? If
so, I'll send it to you.
Much appreciated.
-C
No problem - thanks for the reply. I tried your suggestion of keeping
a widget for each plot, but I couldn't get the main window to refresh
correctly - maybe I was doing something wrong. I'll give it another
try as soon as I get a chance. In the meantime, I'll check out glue
as well - it looks pretty cool.
I might bug you one more time if I can't figure it out, but I am not
in a hurry and I probably just overlooked something. :)
Thanks and much appreciated!
-C
Sorry this didn't get a response for so long.
The core of the embedding in Qt is at QWidget which contains the canvas.
Anything you want to do with a QWidget you can do with the canvas.
Independently you need to maintain the mpl level plotting objects (the
Figure, Axes, and Artist objects) (well, you don't _need_ to, you can
get to
them through the canvas object, but to keep your self sane I highly
recommend keeping track of the mpl objects your self, this linkage is
there
so that GUI generated draw commands can trigger a re-rendering of the
figure).
I would just have a widget for each of the plots you want to have and
then
cycle which one is visible in the main window, that is probably a lot
easier
than trying to attach and detach canvases from Figures.
I would also take a look at glue
http://www.glueviz.org/en/stable/installation.html who may have solved
many
of these problems for you.
Tom
Hi all,
I often have scripts that make a lot of plots, and I would like to be
able to create the plots and then have a UI tool that shows a list of
their titles, click on the title and have the plot be drawn in a
window. So far, I have been able to use PyQt to create a UI with a
list box and a Widget to display plots. What I can't seem to figure
out is how to make a bunch of plots and then have the Window update.
list of plots = []
plots.append(plot(dataset))
add plot title to UI list, position in list is reference back
into list of plots
click on plot name/title
widget draws plot
So - basically like docked plots, except there is just a list to the
side instead (much cleaner IMHO)
I haven't been able to find any examples from googling. Has any one
been able to do this or seen examples?
Any help or suggestions are appreciated!
Thanks!
------------------------------------------------------------
------------------
Post by Thomas Caswell
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is
your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now. http://goparallel.sourceforge.
net/
Post by Thomas Caswell
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Ryan Nelson
2015-02-18 17:49:06 UTC
Permalink
Tom et al.,

I don't know about this exact application... However, a couple of months
ago, I asked on the Scipy mailing list about updating the Scipy cookbook
page for Qt/Matplotlib (
http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer),
but I never got a response. The cookbook example is terribly out of date,
so I worked out a pretty simple example that essentially reproduces the Qt
backend plotting window. See my post (
http://mail.scipy.org/pipermail/scipy-dev/2014-December/020258.html) for an
initial version of the code. I may have updated it since that time. If you
are asking for an example for the MPL docs, I would be happy to write my
example up with some picts, if you could tell me where the most appropriate
place in the documentation would be for such an addition.

(However, it sounds like Creator will supersede Designer for Qt5 so...)

Ryan
Post by Thomas Caswell
A good tutorial on how to make mpl play nice with QtDesigner would be a
useful thing to have in the documentation. It would be appreciated if you
could take a crack at writing that up.
Tom
---------- Forwarded message ---------
Date: Wed Feb 18 2015 at 12:25:10 PM
Subject: Re: [Matplotlib-users] Keep list of figures or plots and flip
through list using UI
Funny thing - shortly after I wrote you - I figured it out. I have a
GUI/Dialog I created with designer that has a push button which cycles
between two plots I stored in a list. If you would like to see my
code, I would be more than happy to share. It isn't fabulous, but it
show the mechanics. I will also take a look at what you just posted
above.
Much appreciated!
-C
Post by Thomas Caswell
Please ping the mailing list again (I cc'd the list on this).
See
https://github.com/tacaswell/leidenfrost/blob/master/
leidenfrost/gui/reader_gui.py#L636
Post by Thomas Caswell
(sorry for the code quality, this is a bespoked gui I wrote as part of my
PhD work, you might be the second person to ever read this code) for a Qt
object that wraps up a `Figure` in a nice-embedded way. Using this
directly
Post by Thomas Caswell
you can keep a list of these objects around and show/hide them using
standard Qt methods. Modifying this a bit you could make this class
based
Post by Thomas Caswell
on a standard Qt widget, embed them all in a main window/what have you
and
Post by Thomas Caswell
then again use standard Qt methods to show/hide individual plots as you
wish.
Tom
Sorry for digging this back up, but I can't seem to get this to work.
I looked at glue as you suggested, but the page says it only supports
python 2.7. As for the Qt examples I can find, all I see how to do is
to feed a single plot widget different data sets - but nothing on
dynamically changing the underlying widget and redrawing. Would you
maybe take a look at my code and tell me what it is I am missing? If
so, I'll send it to you.
Much appreciated.
-C
No problem - thanks for the reply. I tried your suggestion of keeping
a widget for each plot, but I couldn't get the main window to refresh
correctly - maybe I was doing something wrong. I'll give it another
try as soon as I get a chance. In the meantime, I'll check out glue
as well - it looks pretty cool.
I might bug you one more time if I can't figure it out, but I am not
in a hurry and I probably just overlooked something. :)
Thanks and much appreciated!
-C
Sorry this didn't get a response for so long.
The core of the embedding in Qt is at QWidget which contains the canvas.
Anything you want to do with a QWidget you can do with the canvas.
Independently you need to maintain the mpl level plotting objects
(the
Post by Thomas Caswell
Figure, Axes, and Artist objects) (well, you don't _need_ to, you can
get to
them through the canvas object, but to keep your self sane I highly
recommend keeping track of the mpl objects your self, this linkage is
there
so that GUI generated draw commands can trigger a re-rendering of the
figure).
I would just have a widget for each of the plots you want to have and
then
cycle which one is visible in the main window, that is probably a lot
easier
than trying to attach and detach canvases from Figures.
I would also take a look at glue
http://www.glueviz.org/en/stable/installation.html who may have
solved
Post by Thomas Caswell
many
of these problems for you.
Tom
Hi all,
I often have scripts that make a lot of plots, and I would like to
be
Post by Thomas Caswell
able to create the plots and then have a UI tool that shows a list
of
Post by Thomas Caswell
their titles, click on the title and have the plot be drawn in a
window. So far, I have been able to use PyQt to create a UI with a
list box and a Widget to display plots. What I can't seem to figure
out is how to make a bunch of plots and then have the Window update.
list of plots = []
plots.append(plot(dataset))
add plot title to UI list, position in list is reference back
into list of plots
click on plot name/title
widget draws plot
So - basically like docked plots, except there is just a list to the
side instead (much cleaner IMHO)
I haven't been able to find any examples from googling. Has any one
been able to do this or seen examples?
Any help or suggestions are appreciated!
Thanks!
------------------------------------------------------------
------------------
Post by Thomas Caswell
Dive into the World of Parallel Programming. The Go Parallel
Website,
Post by Thomas Caswell
sponsored by Intel and developed in partnership with Slashdot Media, is
your
hub for all things parallel software development, from weekly
thought
Post by Thomas Caswell
leadership blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now. http://goparallel.sourceforge.
net/
Post by Thomas Caswell
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Thomas Caswell
2015-02-18 17:56:58 UTC
Permalink
Probably in the embedding examples.

There was an effort to start a mpl specific cook book a while a ago based
around a wx/glade example but I have lost track of where that is.

Tom
Post by Ryan Nelson
Tom et al.,
I don't know about this exact application... However, a couple of months
ago, I asked on the Scipy mailing list about updating the Scipy cookbook
page for Qt/Matplotlib (
http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer),
but I never got a response. The cookbook example is terribly out of date,
so I worked out a pretty simple example that essentially reproduces the Qt
backend plotting window. See my post (
http://mail.scipy.org/pipermail/scipy-dev/2014-December/020258.html) for
an initial version of the code. I may have updated it since that time. If
you are asking for an example for the MPL docs, I would be happy to write
my example up with some picts, if you could tell me where the most
appropriate place in the documentation would be for such an addition.
(However, it sounds like Creator will supersede Designer for Qt5 so...)
Ryan
Post by Thomas Caswell
A good tutorial on how to make mpl play nice with QtDesigner would be a
useful thing to have in the documentation. It would be appreciated if you
could take a crack at writing that up.
Tom
---------- Forwarded message ---------
Date: Wed Feb 18 2015 at 12:25:10 PM
Subject: Re: [Matplotlib-users] Keep list of figures or plots and flip
through list using UI
Funny thing - shortly after I wrote you - I figured it out. I have a
GUI/Dialog I created with designer that has a push button which cycles
between two plots I stored in a list. If you would like to see my
code, I would be more than happy to share. It isn't fabulous, but it
show the mechanics. I will also take a look at what you just posted
above.
Much appreciated!
-C
Post by Thomas Caswell
Please ping the mailing list again (I cc'd the list on this).
See
https://github.com/tacaswell/leidenfrost/blob/master/
leidenfrost/gui/reader_gui.py#L636
Post by Thomas Caswell
(sorry for the code quality, this is a bespoked gui I wrote as part of
my
Post by Thomas Caswell
PhD work, you might be the second person to ever read this code) for a
Qt
Post by Thomas Caswell
object that wraps up a `Figure` in a nice-embedded way. Using this
directly
Post by Thomas Caswell
you can keep a list of these objects around and show/hide them using
standard Qt methods. Modifying this a bit you could make this class
based
Post by Thomas Caswell
on a standard Qt widget, embed them all in a main window/what have you
and
Post by Thomas Caswell
then again use standard Qt methods to show/hide individual plots as you
wish.
Tom
Sorry for digging this back up, but I can't seem to get this to work.
I looked at glue as you suggested, but the page says it only supports
python 2.7. As for the Qt examples I can find, all I see how to do is
to feed a single plot widget different data sets - but nothing on
dynamically changing the underlying widget and redrawing. Would you
maybe take a look at my code and tell me what it is I am missing? If
so, I'll send it to you.
Much appreciated.
-C
No problem - thanks for the reply. I tried your suggestion of
keeping
Post by Thomas Caswell
a widget for each plot, but I couldn't get the main window to refresh
correctly - maybe I was doing something wrong. I'll give it another
try as soon as I get a chance. In the meantime, I'll check out glue
as well - it looks pretty cool.
I might bug you one more time if I can't figure it out, but I am not
in a hurry and I probably just overlooked something. :)
Thanks and much appreciated!
-C
Sorry this didn't get a response for so long.
The core of the embedding in Qt is at QWidget which contains the canvas.
Anything you want to do with a QWidget you can do with the canvas.
Independently you need to maintain the mpl level plotting objects
(the
Post by Thomas Caswell
Figure, Axes, and Artist objects) (well, you don't _need_ to, you
can
Post by Thomas Caswell
get to
them through the canvas object, but to keep your self sane I highly
recommend keeping track of the mpl objects your self, this linkage
is
Post by Thomas Caswell
there
so that GUI generated draw commands can trigger a re-rendering of
the
Post by Thomas Caswell
figure).
I would just have a widget for each of the plots you want to have
and
Post by Thomas Caswell
then
cycle which one is visible in the main window, that is probably a
lot
Post by Thomas Caswell
easier
than trying to attach and detach canvases from Figures.
I would also take a look at glue
http://www.glueviz.org/en/stable/installation.html who may have
solved
Post by Thomas Caswell
many
of these problems for you.
Tom
Hi all,
I often have scripts that make a lot of plots, and I would like to
be
Post by Thomas Caswell
able to create the plots and then have a UI tool that shows a list
of
Post by Thomas Caswell
their titles, click on the title and have the plot be drawn in a
window. So far, I have been able to use PyQt to create a UI with a
list box and a Widget to display plots. What I can't seem to
figure
Post by Thomas Caswell
out is how to make a bunch of plots and then have the Window
update.
Post by Thomas Caswell
list of plots = []
plots.append(plot(dataset))
add plot title to UI list, position in list is reference
back
Post by Thomas Caswell
into list of plots
click on plot name/title
widget draws plot
So - basically like docked plots, except there is just a list to
the
Post by Thomas Caswell
side instead (much cleaner IMHO)
I haven't been able to find any examples from googling. Has any
one
Post by Thomas Caswell
been able to do this or seen examples?
Any help or suggestions are appreciated!
Thanks!
------------------------------------------------------------
------------------
Post by Thomas Caswell
Dive into the World of Parallel Programming. The Go Parallel
Website,
Post by Thomas Caswell
sponsored by Intel and developed in partnership with Slashdot
Media,
Post by Thomas Caswell
is
your
hub for all things parallel software development, from weekly
thought
Post by Thomas Caswell
leadership blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now. http://goparallel.sourceforge.
net/
Post by Thomas Caswell
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...