Skip to content

Commit 2d8bd62

Browse files
committed
Recreated deprecated files and changed references
1 parent 8eacacb commit 2d8bd62

File tree

11 files changed

+33
-18
lines changed

11 files changed

+33
-18
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Modules ``tight_bbox`` and ``tight_layout`` deprecated
2+
------------------------------------------------------
3+
4+
The modules ``matplotlib.tight_bbox`` and ``matplotlib.tight_layout`` are
5+
considered internal and public access is deprecated.

doc/api/prev_api_changes/api_changes_1.4.x.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ original location:
149149
``drawRect`` from ``FigureCanvasQTAgg``; they were always an
150150
implementation detail of the (preserved) ``drawRectangle()`` function.
151151

152-
* The function signatures of `.tight_bbox.adjust_bbox` and
153-
`.tight_bbox.process_figure_for_rasterizing` have been changed. A new
154-
*fixed_dpi* parameter allows for overriding the ``figure.dpi`` setting
152+
* The function signatures of ``matplotlib.tight_bbox.adjust_bbox`` and
153+
``matplotlib.tight_bbox.process_figure_for_rasterizing`` have been changed.
154+
A new *fixed_dpi* parameter allows for overriding the ``figure.dpi`` setting
155155
instead of trying to deduce the intended behaviour from the file format.
156156

157157
* Added support for horizontal/vertical axes padding to

doc/api/prev_api_changes/api_changes_2.2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ If `.MovieWriterRegistry` can't find the requested `.MovieWriter`, a
159159
more helpful `RuntimeError` message is now raised instead of the
160160
previously raised `KeyError`.
161161

162-
`~.tight_layout.auto_adjust_subplotpars` now raises `ValueError`
162+
``matplotlib.tight_layout.auto_adjust_subplotpars`` now raises `ValueError`
163163
instead of `RuntimeError` when sizes of input lists don't match
164164

165165

doc/api/prev_api_changes/api_changes_3.0.1.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
API Changes for 3.0.1
22
=====================
33

4-
`.tight_layout.auto_adjust_subplotpars` can return ``None`` now if the new
5-
subplotparams will collapse axes to zero width or height. This prevents
6-
``tight_layout`` from being executed. Similarly
7-
`.tight_layout.get_tight_layout_figure` will return None.
4+
``matplotlib.tight_layout.auto_adjust_subplotpars`` can return ``None`` now if
5+
the new subplotparams will collapse axes to zero width or height.
6+
This prevents ``tight_layout`` from being executed. Similarly
7+
``matplotlib.tight_layout.get_tight_layout_figure`` will return None.
88

99
To improve import (startup) time, private modules are now imported lazily.
1010
These modules are no longer available at these locations:

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import matplotlib as mpl
4545
from matplotlib import (
4646
_api, backend_tools as tools, cbook, colors, docstring, textpath,
47-
tight_bbox, transforms, widgets, get_backend, is_interactive, rcParams)
47+
_tight_bbox, transforms, widgets, get_backend, is_interactive, rcParams)
4848
from matplotlib._pylab_helpers import Gcf
4949
from matplotlib.backend_managers import ToolManager
5050
from matplotlib.cbook import _setattr_cm
@@ -2248,7 +2248,7 @@ def print_figure(
22482248
bbox_inches = bbox_inches.padded(pad_inches)
22492249

22502250
# call adjust_bbox to save only the given area
2251-
restore_bbox = tight_bbox.adjust_bbox(
2251+
restore_bbox = _tight_bbox.adjust_bbox(
22522252
self.figure, bbox_inches, self.figure.canvas.fixed_dpi)
22532253

22542254
_bbox_inches_restore = (bbox_inches, restore_bbox)

lib/matplotlib/backends/backend_mixed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from matplotlib import cbook
44
from matplotlib.backends.backend_agg import RendererAgg
5-
from matplotlib.tight_bbox import process_figure_for_rasterizing
5+
from matplotlib._tight_bbox import process_figure_for_rasterizing
66

77

88
class MixedModeRenderer:

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _get_nth_label_width(self, nth):
282282
figure=fig,
283283
size=self.labelFontSizeList[nth],
284284
fontproperties=self.labelFontProps)
285-
.get_window_extent(mpl.tight_layout.get_renderer(fig)).width)
285+
.get_window_extent(mpl._tight_layout.get_renderer(fig)).width)
286286

287287
@_api.deprecated("3.5")
288288
def get_label_width(self, lev, fmt, fsize):
@@ -292,7 +292,7 @@ def get_label_width(self, lev, fmt, fsize):
292292
fig = self.axes.figure
293293
width = (text.Text(0, 0, lev, figure=fig,
294294
size=fsize, fontproperties=self.labelFontProps)
295-
.get_window_extent(mpl.tight_layout.get_renderer(fig)).width)
295+
.get_window_extent(mpl._tight_layout.get_renderer(fig)).width)
296296
width *= 72 / fig.dpi
297297
return width
298298

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3181,7 +3181,7 @@ def tight_layout(self, *, pad=1.08, h_pad=None, w_pad=None, rect=None):
31813181
.pyplot.tight_layout
31823182
"""
31833183
from contextlib import nullcontext
3184-
from .tight_layout import (
3184+
from ._tight_layout import (
31853185
get_subplotspec_list, get_tight_layout_figure)
31863186
subplotspec_list = get_subplotspec_list(self.axes)
31873187
if None in subplotspec_list:

lib/matplotlib/gridspec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import numpy as np
1919

2020
import matplotlib as mpl
21-
from matplotlib import _api, _pylab_helpers, tight_layout, rcParams
21+
from matplotlib import _api, _pylab_helpers, _tight_layout, rcParams
2222
from matplotlib.transforms import Bbox
2323

2424
_log = logging.getLogger(__name__)
@@ -466,17 +466,17 @@ def tight_layout(self, figure, renderer=None,
466466
fit into.
467467
"""
468468

469-
subplotspec_list = tight_layout.get_subplotspec_list(
469+
subplotspec_list = _tight_layout.get_subplotspec_list(
470470
figure.axes, grid_spec=self)
471471
if None in subplotspec_list:
472472
_api.warn_external("This figure includes Axes that are not "
473473
"compatible with tight_layout, so results "
474474
"might be incorrect.")
475475

476476
if renderer is None:
477-
renderer = tight_layout.get_renderer(figure)
477+
renderer = _tight_layout.get_renderer(figure)
478478

479-
kwargs = tight_layout.get_tight_layout_figure(
479+
kwargs = _tight_layout.get_tight_layout_figure(
480480
figure, figure.axes, subplotspec_list, renderer,
481481
pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
482482
if kwargs:

lib/matplotlib/tight_bbox.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from matplotlib._tight_bbox import * # noqa: F401, F403
2+
from matplotlib import _api
3+
_api.warn_deprecated(
4+
"3.6", message="The module %(name)s is deprecated since %(since)s.",
5+
name=f"{__name__}")

0 commit comments

Comments
 (0)