Animate contour plot and color bar

For my program I have been trying to animate a contour plot, the color bar,
and a subtitle saying what time step it is. I have gotten the graph to write
over itself but cannot get it clear the screen properly. Currently using the
clf function the wipe is visible messing with animation.

Here is a link to my project, the graph code is all in gui.py the rest of
the files are for the generation of the data.
http://code.google.com/p/scc08/source/browse/#svn/branch/realistic2d

···

--
View this message in context: http://www.nabble.com/Animate-contour-plot-and-color-bar-tp22671942p22671942.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Deltarodigy wrote:

For my program I have been trying to animate a contour plot, the color bar,
and a subtitle saying what time step it is. I have gotten the graph to write
over itself but cannot get it clear the screen properly. Currently using the
clf function the wipe is visible messing with animation.

This is because all pylab/pyplot functions include a draw_if_interactive. They are intended for interactive use, not for programmed animation. For that you should use the OO interface. Have you worked through the animation examples? http://matplotlib.sourceforge.net/examples/index.html

Mpl is not particularly fast, and some operations like contouring are inherently slow, so unless the fields you are contouring are quite simple you may run into performance problems.

For animation of contours, you normally want to have contours at fixed intervals, so I expect you will want to specify those contour levels as an argument to the contour and contourf functions (or Axes methods, when you switch to an OO style.) That will allow drawing the colorbar only once.

Eric

···

Here is a link to my project, the graph code is all in gui.py the rest of
the files are for the generation of the data.
http://code.google.com/p/scc08/source/browse/#svn/branch/realistic2d

efiring wrote:

Deltarodigy wrote:

For my program I have been trying to animate a contour plot, the color
bar,
and a subtitle saying what time step it is. I have gotten the graph to
write
over itself but cannot get it clear the screen properly. Currently using
the
clf function the wipe is visible messing with animation.

This is because all pylab/pyplot functions include a
draw_if_interactive. They are intended for interactive use, not for
programmed animation. For that you should use the OO interface. Have
you worked through the animation examples?
http://matplotlib.sourceforge.net/examples/index.html

Mpl is not particularly fast, and some operations like contouring are
inherently slow, so unless the fields you are contouring are quite
simple you may run into performance problems.

For animation of contours, you normally want to have contours at fixed
intervals, so I expect you will want to specify those contour levels as
an argument to the contour and contourf functions (or Axes methods, when
you switch to an OO style.) That will allow drawing the colorbar only
once.

Eric

Here is a link to my project, the graph code is all in gui.py the rest of
the files are for the generation of the data.
http://code.google.com/p/scc08/source/browse/#svn/branch/realistic2d

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I have gotten that far the calculations take so long the rendering speed is
not too important. I have been working on this and I got the subtitle to
animate. My current problem involves the colorbar. When I update the contour
graph and the titles the written over cleanly, but when the colorbar is
redrawn it draws a second one right next to it. Reading other threads I
tried the clf command but the makes the animation kludgy and it has to
reshrink all of the graphs and such.

···

--
View this message in context: http://www.nabble.com/Animate-contour-plot-and-color-bar-tp22671942p22672958.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Deltarodigy wrote:

efiring wrote:

Deltarodigy wrote:

For my program I have been trying to animate a contour plot, the color
bar,
and a subtitle saying what time step it is. I have gotten the graph to
write
over itself but cannot get it clear the screen properly. Currently using
the
clf function the wipe is visible messing with animation.

This is because all pylab/pyplot functions include a draw_if_interactive. They are intended for interactive use, not for programmed animation. For that you should use the OO interface. Have you worked through the animation examples? http://matplotlib.sourceforge.net/examples/index.html

Mpl is not particularly fast, and some operations like contouring are inherently slow, so unless the fields you are contouring are quite simple you may run into performance problems.

For animation of contours, you normally want to have contours at fixed intervals, so I expect you will want to specify those contour levels as an argument to the contour and contourf functions (or Axes methods, when you switch to an OO style.) That will allow drawing the colorbar only
once.

Eric

Here is a link to my project, the graph code is all in gui.py the rest of
the files are for the generation of the data.
http://code.google.com/p/scc08/source/browse/#svn/branch/realistic2d

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I have gotten that far the calculations take so long the rendering speed is
not too important. I have been working on this and I got the subtitle to
animate. My current problem involves the colorbar. When I update the contour
graph and the titles the written over cleanly, but when the colorbar is
redrawn it draws a second one right next to it. Reading other threads I
tried the clf command but the makes the animation kludgy and it has to
reshrink all of the graphs and such.

Again, don't use the pyplot interface! For an animation, avoid having to redraw the colorbar at all; and don't use the pyplot colorbar command, use the Figure.colorbar method, and explicitly pass in the colorbar axes to use, via the cax kwarg. Don't leave creation of its axes to the colorbar method itself more than once, because it will always create a new one.

Eric

Ok so I have been looking into the Figure class and I still not clear on how
figure works. Does it contain all of the normal functions that are in pylab?
Does it just contain axes which are are where the graphs are, like subplots
in pylab? Do I need to use figure inside of wx widgets or other windowing
toolkit? (It seems from the examples this is true) Any help understanding
this would be appreciated.

efiring wrote:

···

Deltarodigy wrote:

efiring wrote:

Deltarodigy wrote:

For my program I have been trying to animate a contour plot, the color
bar,
and a subtitle saying what time step it is. I have gotten the graph to
write
over itself but cannot get it clear the screen properly. Currently
using
the
clf function the wipe is visible messing with animation.

This is because all pylab/pyplot functions include a
draw_if_interactive. They are intended for interactive use, not for
programmed animation. For that you should use the OO interface. Have
you worked through the animation examples?
http://matplotlib.sourceforge.net/examples/index.html

Mpl is not particularly fast, and some operations like contouring are
inherently slow, so unless the fields you are contouring are quite
simple you may run into performance problems.

For animation of contours, you normally want to have contours at fixed
intervals, so I expect you will want to specify those contour levels as
an argument to the contour and contourf functions (or Axes methods, when
you switch to an OO style.) That will allow drawing the colorbar only
once.

Eric

Here is a link to my project, the graph code is all in gui.py the rest
of
the files are for the generation of the data.
http://code.google.com/p/scc08/source/browse/#svn/branch/realistic2d

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based
development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I have gotten that far the calculations take so long the rendering speed
is
not too important. I have been working on this and I got the subtitle to
animate. My current problem involves the colorbar. When I update the
contour
graph and the titles the written over cleanly, but when the colorbar is
redrawn it draws a second one right next to it. Reading other threads I
tried the clf command but the makes the animation kludgy and it has to
reshrink all of the graphs and such.

Again, don't use the pyplot interface! For an animation, avoid having
to redraw the colorbar at all; and don't use the pyplot colorbar
command, use the Figure.colorbar method, and explicitly pass in the
colorbar axes to use, via the cax kwarg. Don't leave creation of its
axes to the colorbar method itself more than once, because it will
always create a new one.

Eric

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
View this message in context: http://www.nabble.com/Animate-contour-plot-and-color-bar-tp22671942p22673591.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Deltarodigy wrote:

Ok so I have been looking into the Figure class and I still not clear on how
figure works. Does it contain all of the normal functions that are in pylab?
Does it just contain axes which are are where the graphs are, like subplots
in pylab? Do I need to use figure inside of wx widgets or other windowing
toolkit? (It seems from the examples this is true) Any help understanding
this would be appreciated.

Please consult the documentation, including examples, to get some background:
http://matplotlib.sourceforge.net/contents.html

Eric