File tree Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -3244,7 +3244,7 @@ def _update_view(self):
3244
3244
def configure_subplots (self , * args ):
3245
3245
if hasattr (self , "subplot_tool" ):
3246
3246
self .subplot_tool .figure .canvas .manager .show ()
3247
- return
3247
+ return self . subplot_tool
3248
3248
# This import needs to happen here due to circular imports.
3249
3249
from matplotlib .figure import Figure
3250
3250
with mpl .rc_context ({"toolbar" : "none" }): # No navbar for the toolfig.
Original file line number Diff line number Diff line change @@ -475,7 +475,7 @@ class NavigationToolbar2:
475
475
def release_zoom (self , event : Event ) -> None : ...
476
476
def push_current (self ) -> None : ...
477
477
subplot_tool : widgets .SubplotTool
478
- def configure_subplots (self , * args ) : ...
478
+ def configure_subplots (self , * args : Any ) -> widgets . SubplotTool : ...
479
479
def save_figure (self , * args ) -> str | None | object : ...
480
480
def update (self ) -> None : ...
481
481
def set_history_buttons (self ) -> None : ...
Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ def set_device_pixel_ratio(ratio):
213
213
def test_subplottool ():
214
214
fig , ax = plt .subplots ()
215
215
with mock.patch ("matplotlib.backends.qt_compat._exec" , lambda obj : None ):
216
- fig .canvas .manager .toolbar .configure_subplots ()
216
+ tool = fig .canvas .manager .toolbar .configure_subplots ()
217
+ assert tool is not None
218
+ assert tool == fig .canvas .manager .toolbar .configure_subplots ()
217
219
218
220
219
221
@pytest .mark .backend ('QtAgg' , skip_on_importerror = True )
Original file line number Diff line number Diff line change @@ -168,7 +168,9 @@ def test_never_update():
168
168
plt .show (block = False )
169
169
170
170
plt .draw () # Test FigureCanvasTkAgg.
171
- fig .canvas .toolbar .configure_subplots () # Test NavigationToolbar2Tk.
171
+ tool = fig .canvas .toolbar .configure_subplots () # Test NavigationToolbar2Tk.
172
+ assert tool is not None
173
+ assert tool == fig .canvas .toolbar .configure_subplots () # Tool is reused internally.
172
174
# Test FigureCanvasTk filter_destroy callback
173
175
fig .canvas .get_tk_widget ().after (100 , plt .close , fig )
174
176
You can’t perform that action at this time.
0 commit comments