MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / subplot_tool

Function subplot_tool

lib/matplotlib/pyplot.py:2158–2178  ·  view source on GitHub ↗

Launch a subplot tool window for a figure. Returns ------- `matplotlib.widgets.SubplotTool`

(targetfig: Figure | None = None)

Source from the content-addressed store, hash-verified

2156
2157
2158def 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
2181def box(on: bool | None = None) -> None:

Callers

nothing calls this directly

Calls 3

gcfFunction · 0.85
configure_subplotsMethod · 0.45
trigger_toolMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…