Launch a subplot tool window for a figure. Returns ------- `matplotlib.widgets.SubplotTool`
(targetfig: Figure | None = None)
| 2156 | |
| 2157 | |
| 2158 | def subplot_tool(targetfig: Figure | None = None) -> SubplotTool | None: |
| 2159 | """ |
| 2160 | Launch a subplot tool window for a figure. |
| 2161 | |
| 2162 | Returns |
| 2163 | ------- |
| 2164 | `matplotlib.widgets.SubplotTool` |
| 2165 | """ |
| 2166 | if targetfig is None: |
| 2167 | targetfig = gcf() |
| 2168 | tb = targetfig.canvas.manager.toolbar # type: ignore[union-attr] |
| 2169 | if hasattr(tb, "configure_subplots"): # toolbar2 |
| 2170 | from matplotlib.backend_bases import NavigationToolbar2 |
| 2171 | return cast(NavigationToolbar2, tb).configure_subplots() |
| 2172 | elif hasattr(tb, "trigger_tool"): # toolmanager |
| 2173 | from matplotlib.backend_bases import ToolContainerBase |
| 2174 | cast(ToolContainerBase, tb).trigger_tool("subplots") |
| 2175 | return None |
| 2176 | else: |
| 2177 | raise ValueError("subplot_tool can only be launched for figures with " |
| 2178 | "an associated toolbar") |
| 2179 | |
| 2180 | |
| 2181 | def box(on: bool | None = None) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…