Exclude invisible artists from a relim() and autoscale_view()?

I am using matplotlib in a wxpython application where series are added dynamically to subplots in a figure. I added the very handy option to toggle series’ visibility (by calling set_visible(False). The catch is however that the invisible series are included in the rescaling of the artists (Line2D all of them). Is there any way to fix that? The behavior I’m after is for rescaling to be based on visible artists only.

The way I am doing the rescaling currently is simply by calling these two methods from the event handler:

event.inaxes.relim()

event.inaxes.autoscale_view(tight=None, scalex=False, scaley=True)

This might be a good feature request to make (if it hasn’t already…):

https://sourceforge.net/tracker/?group_id=80706

I would like to add one caveat, however. There are some cases where one would want to include the bounding boxes of the invisible artist elements in determining the axes limits. A particular use case would be animations. I believe that matplotlib would be best served by having a simple option available to let the user determine if they want to include invisible artists or not.

Ben Root

···

On Wed, Dec 15, 2010 at 8:13 AM, Åke Kullenberg <ake.kullenberg@…287…> wrote:

I am using matplotlib in a wxpython application where series are added dynamically to subplots in a figure. I added the very handy option to toggle series’ visibility (by calling set_visible(False). The catch is however that the invisible series are included in the rescaling of the artists (Line2D all of them). Is there any way to fix that? The behavior I’m after is for rescaling to be based on visible artists only.

The way I am doing the rescaling currently is simply by calling these two methods from the event handler:

event.inaxes.relim()

event.inaxes.autoscale_view(tight=None, scalex=False, scaley=True)

I added a feature request. It would be awesome to just have an extra tag whether to include invisible artists.

···

On Wed, Dec 15, 2010 at 10:36 PM, Benjamin Root <ben.root@…1304…> wrote:

On Wed, Dec 15, 2010 at 8:13 AM, Åke Kullenberg <ake.kullenberg@…287…> wrote:

I am using matplotlib in a wxpython application where series are added dynamically to subplots in a figure. I added the very handy option to toggle series’ visibility (by calling set_visible(False). The catch is however that the invisible series are included in the rescaling of the artists (Line2D all of them). Is there any way to fix that? The behavior I’m after is for rescaling to be based on visible artists only.

The way I am doing the rescaling currently is simply by calling these two methods from the event handler:

event.inaxes.relim()

event.inaxes.autoscale_view(tight=None, scalex=False, scaley=True)

This might be a good feature request to make (if it hasn’t already…):

https://sourceforge.net/tracker/?group_id=80706

I would like to add one caveat, however. There are some cases where one would want to include the bounding boxes of the invisible artist elements in determining the axes limits. A particular use case would be animations. I believe that matplotlib would be best served by having a simple option available to let the user determine if they want to include invisible artists or not.

Ben Root