I'm trying to use matplotlib for animating data as it is received from
an online source (online in the algorithmic
sense not internet:). I'd like the graph plot to be updated with high
frequency since the data changes rapidly. I've
used the BufferRegion with copy_from_bbox / restore_region and it
speeds up the plotting considerably but alas it's
still not good enough (with a large number of graphs and a large
number of data points in each graph).
What I'd like to do is to utilize the fact that the animation is
updated in a predictable fashion (i.e., scrolling off
the screen to the left as new data arrives) in order to speed up the
animation. The idea would be to copy the right 99%
of the graph (or some other fraction) via some kind of function
similar to copy_from_bbox, move it 1% to the left and
then plot the new 1% of the data. The problem is that as far as I can
tell the copy_from_bbox/restore_region does not
actually allow changing the area in which it is restored. I've mucked
around in the source files a bit but to no avail.
My question is then:
1. Is there some other way to copy everything enclosed in a Bbox? or
2. Is there some way to modify the region in which data reappears when
using restore_region?
3. Perhaps I'm missing something?
It would also be nice if it was possible to transform the plot (i.e.
make it larger/smaller depending on how the y-axis changes) although I
suppose this is doable via using an auxiliary canvas.
I'm sure someone else has done this since it seems pretty natural and
useful for a variety of applications.
···
--
If I knew that a man was coming to my house with the conscious design
of doing me good, I should run for my life.
- Henry David Thoreau
Without a small example, it’s hard to know for sure. Are you using Line2D.set_data to update with new data or are you doing a new plot? Since you have multiple graphs, have you looked at making a LineCollection object by hand, which will decrease the number of function calls when drawing?
Just some ideas,
Ryan
···
On Wed, Apr 22, 2009 at 10:11 AM, Elan Pavlov <epavlov@…287…> wrote:
I’m trying to use matplotlib for animating data as it is received from
an online source (online in the algorithmic
sense not internet:). I’d like the graph plot to be updated with high
frequency since the data changes rapidly. I’ve
used the BufferRegion with copy_from_bbox / restore_region and it
speeds up the plotting considerably but alas it’s
still not good enough (with a large number of graphs and a large
number of data points in each graph).
What I’d like to do is to utilize the fact that the animation is
updated in a predictable fashion (i.e., scrolling off
the screen to the left as new data arrives) in order to speed up the
animation. The idea would be to copy the right 99%
of the graph (or some other fraction) via some kind of function
similar to copy_from_bbox, move it 1% to the left and
then plot the new 1% of the data. The problem is that as far as I can
tell the copy_from_bbox/restore_region does not
actually allow changing the area in which it is restored. I’ve mucked
around in the source files a bit but to no avail.
My question is then:
-
Is there some other way to copy everything enclosed in a Bbox? or
-
Is there some way to modify the region in which data reappears when
using restore_region?
- Perhaps I’m missing something?
It would also be nice if it was possible to transform the plot (i.e.
make it larger/smaller depending on how the y-axis changes) although I
suppose this is doable via using an auxiliary canvas.
I’m sure someone else has done this since it seems pretty natural and
useful for a variety of applications.
–
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
Yes, I'm using the line2D.set_data function along with the draw_artist
(and a blit). I haven't made a line collection object since I don't
think it will speed it up by around the factor 5 that I want. I'll try
that but I still think that the ability to grab a large section of the
canvas and move it would speed things up considerably as well as be
useful for other things.
Elan
···
On Wed, Apr 22, 2009 at 1:10 PM, Ryan May <rmay31@...287...> wrote:
On Wed, Apr 22, 2009 at 10:11 AM, Elan Pavlov <epavlov@...287...> wrote:
I'm trying to use matplotlib for animating data as it is received from
an online source (online in the algorithmic
sense not internet:). I'd like the graph plot to be updated with high
frequency since the data changes rapidly. I've
used the BufferRegion with copy_from_bbox / restore_region and it
speeds up the plotting considerably but alas it's
still not good enough (with a large number of graphs and a large
number of data points in each graph).
What I'd like to do is to utilize the fact that the animation is
updated in a predictable fashion (i.e., scrolling off
the screen to the left as new data arrives) in order to speed up the
animation. The idea would be to copy the right 99%
of the graph (or some other fraction) via some kind of function
similar to copy_from_bbox, move it 1% to the left and
then plot the new 1% of the data. The problem is that as far as I can
tell the copy_from_bbox/restore_region does not
actually allow changing the area in which it is restored. I've mucked
around in the source files a bit but to no avail.
My question is then:
1. Is there some other way to copy everything enclosed in a Bbox? or
2. Is there some way to modify the region in which data reappears when
using restore_region?
3. Perhaps I'm missing something?
It would also be nice if it was possible to transform the plot (i.e.
make it larger/smaller depending on how the y-axis changes) although I
suppose this is doable via using an auxiliary canvas.
I'm sure someone else has done this since it seems pretty natural and
useful for a variety of applications.
Without a small example, it's hard to know for sure. Are you using
Line2D.set_data to update with new data or are you doing a new plot? Since
you have multiple graphs, have you looked at making a LineCollection object
by hand, which will decrease the number of function calls when drawing?
Just some ideas,
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
If I knew that a man was coming to my house with the conscious design
of doing me good, I should run for my life.
- Henry David Thoreau