| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Only propagate stale state to the figure from it's direct children, not all artists. This is to prevent double call backs when using interactive mode with backends which do not implement an asynchronous draw_idle.
This is to match the behavior of artists being uniquely associated with a single Axes.
If a draw has been forced, but either the figure or axes is not stale some of the draw processes will cause them to become scale (because the current implementation is naive and does no check if values have changed so no-op sets still mark the artist as stale). By setting _stale to be True the stale events will not propagate past the axes/figure and schedule another redraw. This only really matters for Canvas classes which do not implement an asynchronous `draw_idle`. If there is an asynchronous `draw_idle` the additional draw requests will be ignored until the current draw is finished anyway.
|
This PR actually only has a single failure (the same in all python versions): ======================================================================
FAIL: matplotlib.tests.test_offsetbox.test_offsetbox_clip_children
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/matplotlib/matplotlib/venv/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/travis/build/matplotlib/matplotlib/venv/lib/python2.6/site-packages/matplotlib-1.5.dev1-py2.6-linux-x86_64.egg/matplotlib/testing/decorators.py", line 110, in wrapped_function
func(*args, **kwargs)
File "/home/travis/build/matplotlib/matplotlib/venv/lib/python2.6/site-packages/matplotlib-1.5.dev1-py2.6-linux-x86_64.egg/matplotlib/tests/test_offsetbox.py", line 83, in test_offsetbox_clip_children
assert_true(fig.stale)
AssertionError
|
Sorry, something went wrong.
When setting the axes of an offset box to propagate to it's children.
|
Turns out the issue was that funny things were happening with the offsetbox subclasses which was getting masked by the fact that before artists were pinging both the axes and the figure, now they just hit the figure. There are probably a bunch more issues like this that we will slowly find... |
Sorry, something went wrong.
Do not re-use a much too broad callback registry for propagating stale state.
|
@rmorshea the stale callbacks have been simplified to not use pchanged anymore. I think this will make replicating the current proposed behavior easier. |
Sorry, something went wrong.
Always propagate stale up (even if immediate parent is stale)
|
I definitely see this as an improvement, modulo investigating the Travis failure. Possibly more to do over time, but I don't see any reason not to do this much now. |
Sorry, something went wrong.
|
The travis issue is triggering draws in a draw. This is caused by:
@mdehoon makes the very good point that due to our late validation of values if you set an invalid value you don't find out until draw time. If the stale state does not propagate past the existing stale artists and you are using plain python then a re-draw won't be triggered the next time the value is changed (as implemented with IPython it will work fine as-is). The solutions to this that I see are:
I am working on adding a commit to make the base draw_idle re-entrant. |
Sorry, something went wrong.
Calling `draw_idle` while executing a `draw_idle` will no-longer infinitely recurse.
|
I think this is ready to go again. |
Sorry, something went wrong.
|
Still, I don't see the value in using sets here, and I don't like that it works now on a technicality. A list would work just fine. It isn't like we are expecting to have many figures to check against. At the extreme end, i would imagine someone doing something fancy with 10 figures, but typically, only 1 or 3 figures. |
Sorry, something went wrong.
|
I disagree about it working on a "technicality"--this is documented python behavior, essentially making the in check work using is. In fact, using in (which uses __eq__) ends up on the same code path as hash: User-defined classes have __eq__() and __hash__() methods by default; with them, all objects compare unequal (except with themselves) and x.__hash__() returns an appropriate value such that x == y implies both that x is y and hash(x) == hash(y). (https://docs.python.org/3/reference/datamodel.html#object.__eq__) However, I do agree that there is essentially no performance difference in our real-world scenarios here. |
Sorry, something went wrong.
|
Ok, just tried out this branch. I was doing an imshow of a very large array (3600x7000), and a basemap plot and using the TkAgg backend. Watching "top" in another terminal, I see the memory usage increasing every time my mouse passes over the figure window. It never goes back down. The amount of memory increases by hundreds of MB for a quick pass over the window. I don't know yet if it is because of this PR, or if it is due to some unfixed issue with stale flags, or something else entirely. Just noting it here for the moment. |
Sorry, something went wrong.
|
Joys... this is on master and this branch. Furthermore, once you pass over the figure window, the memory usage keeps creeping up, even though the mouse is no longer over the window. |
Sorry, something went wrong.
|
Try commenting out the mouse hover logic in backed base. On Wed, Aug 12, 2015, 2:27 PM Benjamin Root notifications@github.com
|
Sorry, something went wrong.
|
Yup, looks like commenting out the contents of NavigationToolbar2.mouse_move "fixed" the problem. Do you think it is a bug to be dealt with here or shall I file a new issue? |
Sorry, something went wrong.
|
Tack it on to the pr where i am working on removing hit list On Wed, Aug 12, 2015, 2:41 PM Benjamin Root notifications@github.com
|
Sorry, something went wrong.
- disconnect the stale_callback (this assumes that matplotlib#4738 goes in) - remove the artist from the Axes.mousover_set - marks the parent axes/figure as stale - resets the artist's axes/figure to None
Artists do not properly guard against being removed from figures or Axes when tracking 'stale'. This will keep them from throwing an exception if they become stale after being removed from an Axes or Figure.
Look at figures, not axes, and use a set
- short circuit if not really chaning state - don't fire stale trigger on changing animation state
When using blitting in animation make sure to set the blitted artsts as animated so that changing their state does not trigger the normal stale -> draw_idle cascade.
|
I can still reproduce the original issue in #4732 when interactivity is on i.e. plt.ion() |
Sorry, something went wrong.
|
I.e if I call set_dashes('--') it triggers that exception on every draw until call set_dashes((1,1)) or whatever but surely that is just missing input validation? |
Sorry, something went wrong.
|
That is the expected behavior, the problem was that previously correcting On Fri, Aug 14, 2015, 4:25 PM Jens Hedegaard Nielsen <
|
Sorry, something went wrong.
|
@tacaswell That makes sense. However, I can't reproduce that on current master. set_dashes((3,'3)) after set_dashes(('--')) correctly triggers the redraw so it seems that either this has already been fixed by something else or I am doing something stupid. In any case this is an improvement to the stale login so I will go ahead and merge it |
Sorry, something went wrong.
MNT: overhaul stale handling
|
Are you using ipython or plain python? The redraw logic is different in the On Fri, Aug 14, 2015, 4:46 PM Jens Hedegaard Nielsen <
|
Sorry, something went wrong.
|
plain python |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes #4732