File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1590,9 +1590,11 @@ def add_container(self, container):
1590
1590
container .set_remove_method (lambda h : self .containers .remove (h ))
1591
1591
return container
1592
1592
1593
- def relim (self ):
1593
+ def relim (self , visible_only = False ):
1594
1594
"""
1595
- Recompute the data limits based on current artists.
1595
+ Recompute the data limits based on current artists. If you want to exclude
1596
+ invisible artists from the calculation, set
1597
+ `visible_only=True`
1596
1598
1597
1599
At present, :class:`~matplotlib.collections.Collection`
1598
1600
instances are not supported.
@@ -1604,10 +1606,12 @@ def relim(self):
1604
1606
self .ignore_existing_data_limits = True
1605
1607
1606
1608
for line in self .lines :
1607
- self ._update_line_limits (line )
1609
+ if not visible_only or line .get_visible ():
1610
+ self ._update_line_limits (line )
1608
1611
1609
1612
for p in self .patches :
1610
- self ._update_patch_limits (p )
1613
+ if not visible_only or p .get_visible ():
1614
+ self ._update_patch_limits (p )
1611
1615
1612
1616
def update_datalim (self , xys , updatex = True , updatey = True ):
1613
1617
"""
You can’t perform that action at this time.
0 commit comments