@@ -1141,6 +1141,7 @@ def cla(self):
1141
1141
self ._ymargin = mpl .rcParams ['axes.ymargin' ]
1142
1142
self ._tight = None
1143
1143
self ._use_sticky_edges = True
1144
+ self ._force_sticky_edges = False
1144
1145
self ._update_transScale () # needed?
1145
1146
1146
1147
self ._get_lines = _process_plot_var_args (self )
@@ -2352,6 +2353,29 @@ def use_sticky_edges(self, b):
2352
2353
self ._use_sticky_edges = bool (b )
2353
2354
# No effect until next autoscaling, which will mark the axes as stale.
2354
2355
2356
+ @property
2357
+ def force_sticky_edges (self ):
2358
+ """
2359
+ When autoscaling, whether to enforce `Artist.sticky_edges`
2360
+ values.
2361
+
2362
+ Default is ``False``.
2363
+
2364
+ By default, when ``sticky_edges`` are present the tighter
2365
+ marging is used between the "automatic" and the "sticky".
2366
+ Setting this to ``True`` forces the use of the specified margins,
2367
+ even if sticky_edge value is far away from datalim.
2368
+
2369
+ The changing this property does not change the plot until
2370
+ `autoscale` or `autoscale_view` is called.
2371
+ """
2372
+ return self ._force_sticky_edges
2373
+
2374
+ @force_sticky_edges .setter
2375
+ def force_sticky_edges (self , b ):
2376
+ self ._force_sticky_edges = bool (b )
2377
+ # No effect until next autoscaling, which will mark the axes as stale.
2378
+
2355
2379
def set_xmargin (self , m ):
2356
2380
"""
2357
2381
Set padding of X data limits prior to autoscaling.
@@ -2644,10 +2668,11 @@ def handle_single_axis(scale, autoscaleon, shared_axes, interval,
2644
2668
x0 , x1 = inverse_trans .transform ([x0t - delta , x1t + delta ])
2645
2669
2646
2670
# Apply sticky bounds.
2671
+ _f = self ._force_sticky_edges
2647
2672
if x0bound is not None :
2648
- x0 = max (x0 , x0bound )
2673
+ x0 = max (x0 , x0bound ) if not _f else x0bound
2649
2674
if x1bound is not None :
2650
- x1 = min (x1 , x1bound )
2675
+ x1 = min (x1 , x1bound ) if not _f else x1bound
2651
2676
2652
2677
if not self ._tight :
2653
2678
x0 , x1 = locator .view_limits (x0 , x1 )
0 commit comments