Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget and animation improvements #3985

Merged
merged 2 commits into from Mar 13, 2015

Conversation

WeatherGod
Copy link
Member

Add a method to RadioButtons and CheckButtons. Also fixed an animation example that needed its blitting turned off in order to show the changes in the x limits over time. Rescaled it to adjust for the performance penalty.

Probably the one questionable thing will be the use of index numbers for the set_active() methods. I decided on using index number for RadioButtons because that is what is used in the constructor for starting out. And I used index numbers for the CheckButtons' set_active() just for consistency. I would be open to turning the CheckButtons' set_active() from a strictly toggle method into an optional setter (so, have a state=None, which would toggle, while a state=True would turn it on and state=False would turn it off).

@@ -32,6 +32,6 @@ def run(data):

return line,

ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why turn off blitting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the animation goes on, the limits keep changing. When blitting is turned
on, you don't see the x-axis change, which is incorrect. Turn blitting off,
and you see the scale change correctly.

On Thu, Jan 8, 2015 at 10:12 PM, Thomas A Caswell notifications@github.com
wrote:

In examples/animation/animate_decay.py
#3985 (diff)
:

@@ -32,6 +32,6 @@ def run(data):

 return line,

-ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
+ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,

why turn of


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3985/files#r22699612.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok. If you move the mouse in and out it triggers a full re-draw (at least on qt) which updates them so I thought it was always updating correctly.

There probably should be some logic someplace in the animation that if any has change to do a full-redraw.

This actually ties back into what @efiring and I were talking about to make pyplot behave better as well as it wouldn't be too hard to co-op that system to allow non-animated artists to make the axes as 'dirty' which would trigger a full-redraw.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't need to do that. The animation module already attaches a reset of
the blit to frame resizes, we just never attached it to other kinds of
changes.

I don't know why it doesn't make a difference for you though. A full redraw
isn't sufficient. The bbox copy has to be reset.
On Jan 8, 2015 10:32 PM, "Thomas A Caswell" notifications@github.com
wrote:

In examples/animation/animate_decay.py
#3985 (diff)
:

@@ -32,6 +32,6 @@ def run(data):

 return line,

-ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
+ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,

ah, ok. If you move the mouse in and out it triggers a full re-draw (at
least on qt) which updates them so I thought it was always updating
correctly.

There probably should be some logic someplace in the animation that if any
has change to do a full-redraw.

This actually ties back into what @efiring https://github.com/efiring
and I were talking about to make pyplot behave better as well as it
wouldn't be too hard to co-op that system to allow non-animated artists to
make the axes as 'dirty' which would trigger a full-redraw.


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3985/files#r22700042.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that the animation code added hooks so that on a redraw event it takes care of re-copying the blit box not to resizes spcefically.

What is going on on my system (I think) is that when you mouse in/out qt triggers a full re-paint (as there may have been silly alpha stuff going on when the window was non-focused (oh, right I also use focus follow mouse so I am really changing the focus state) ) and that repaint from the windowing system bubbles down and does a full re-draw of the canvas which updates the tick labels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be the case. It was a long time ago that Ryan and I worked on
that part. If that is the case, then a focus-follows-mouse setup would
trigger a redraw and thus reset the blit. In any case, let's focus on the
other questions for this PR: 1) should we use indexes or string labels and
2) should the check button's set_active() allow for explicit setting of the
state rather than strictly toggling?

On Thu, Jan 8, 2015 at 11:11 PM, Thomas A Caswell notifications@github.com
wrote:

In examples/animation/animate_decay.py
#3985 (diff)
:

@@ -32,6 +32,6 @@ def run(data):

 return line,

-ani = animation.FuncAnimation(fig, run, data_gen, blit=True, interval=10,
+ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,

I thought that the animation code added hooks so that on a redraw event it
takes care of re-copying the blit box not to resizes spcefically.

What is going on on my system (I think) is that when you mouse in/out qt
triggers a full re-paint (as there may have been silly alpha stuff going on
when the window was non-focused (oh, right I also use focus follow mouse so
I am really changing the focus state) ) and that repaint from the windowing
system bubbles down and does a full re-draw of the canvas which updates the
tick labels.


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3985/files#r22700791.

@tacaswell tacaswell added this to the v1.5.x milestone Jan 9, 2015
@tacaswell tacaswell modified the milestones: proposed next point release, next point release Feb 19, 2015
tacaswell added a commit that referenced this pull request Mar 13, 2015
ENH : Widget and animation improvements
@tacaswell tacaswell merged commit 3a5e624 into matplotlib:master Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants