Skip to content

Commit 1d6a018

Browse files
committed
Hurrah for sed!
1 parent 5cc7449 commit 1d6a018

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+437
-437
lines changed

lib/matplotlib/_constrained_layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def get_pos_and_bbox(ax, renderer):
627627
bbox : `~matplotlib.transforms.Bbox`
628628
Tight bounding box in figure coordinates.
629629
"""
630-
fig = ax.figure
630+
fig = ax._figure
631631
pos = ax.get_position(original=True)
632632
# pos is in panel co-ords, but we need in figure for the layout
633633
pos = pos.transformed(fig.transSubfigure - fig.transFigure)
@@ -699,7 +699,7 @@ def reposition_colorbar(layoutgrids, cbax, renderer, *, offset=None):
699699

700700
parents = cbax._colorbar_info['parents']
701701
gs = parents[0].get_gridspec()
702-
fig = cbax.figure
702+
fig = cbax._figure
703703
trans_fig_to_subfig = fig.transFigure - fig.transSubfigure
704704

705705
cb_rspans, cb_cspans = get_cb_parent_spans(cbax)

lib/matplotlib/animation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,13 +1180,13 @@ def _blit_draw(self, artists):
11801180
view, bg = self._blit_cache.get(ax, (object(), None))
11811181
if cur_view != view:
11821182
self._blit_cache[ax] = (
1183-
cur_view, ax.figure.canvas.copy_from_bbox(ax.bbox))
1183+
cur_view, ax._figure.canvas.copy_from_bbox(ax.bbox))
11841184
# Make a separate pass to draw foreground.
11851185
for a in artists:
11861186
a.axes.draw_artist(a)
11871187
# After rendering all the needed artists, blit each Axes individually.
11881188
for ax in updated_ax:
1189-
ax.figure.canvas.blit(ax.bbox)
1189+
ax._figure.canvas.blit(ax.bbox)
11901190

11911191
def _blit_clear(self, artists):
11921192
# Get a list of the Axes that need clearing from the artists that
@@ -1199,7 +1199,7 @@ def _blit_clear(self, artists):
11991199
except KeyError:
12001200
continue
12011201
if ax._get_view() == view:
1202-
ax.figure.canvas.restore_region(bg)
1202+
ax._figure.canvas.restore_region(bg)
12031203
else:
12041204
self._blit_cache.pop(ax)
12051205

lib/matplotlib/artist.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def draw_wrapper(artist, renderer):
7575
renderer.stop_filter(artist.get_agg_filter())
7676
if artist.get_rasterized():
7777
renderer._raster_depth -= 1
78-
if (renderer._rasterizing and artist.figure and
79-
artist.figure.suppressComposite):
78+
if (renderer._rasterizing and artist._figure and
79+
artist._figure.suppressComposite):
8080
# restart rasterizing to prevent merging
8181
renderer.stop_rasterizing()
8282
renderer.start_rasterizing()
@@ -248,10 +248,10 @@ def remove(self):
248248
self.axes = None # decouple the artist from the Axes
249249
_ax_flag = True
250250

251-
if self.figure:
251+
if self._figure:
252252
if not _ax_flag:
253-
self.figure.stale = True
254-
self.figure = None
253+
self._figure.stale = True
254+
self._figure = None
255255

256256
else:
257257
raise NotImplementedError('cannot remove artist')
@@ -475,8 +475,8 @@ def _different_canvas(self, event):
475475
return False, {}
476476
# subclass-specific implementation follows
477477
"""
478-
return (getattr(event, "canvas", None) is not None and self.figure is not None
479-
and event.canvas is not self.figure.canvas)
478+
return (getattr(event, "canvas", None) is not None and self._figure is not None
479+
and event.canvas is not self._figure.canvas)
480480

481481
def contains(self, mouseevent):
482482
"""
@@ -506,7 +506,7 @@ def pickable(self):
506506
--------
507507
.Artist.set_picker, .Artist.get_picker, .Artist.pick
508508
"""
509-
return self.figure is not None and self._picker is not None
509+
return self._figure is not None and self._picker is not None
510510

511511
def pick(self, mouseevent):
512512
"""
@@ -528,7 +528,7 @@ def pick(self, mouseevent):
528528
else:
529529
inside, prop = self.contains(mouseevent)
530530
if inside:
531-
PickEvent("pick_event", self.figure.canvas,
531+
PickEvent("pick_event", self._figure.canvas,
532532
mouseevent, self, **prop)._process()
533533

534534
# Pick children
@@ -746,18 +746,18 @@ def set_figure(self, fig):
746746
fig : `~matplotlib.figure.Figure`
747747
"""
748748
# if this is a no-op just return
749-
if self.figure is fig:
749+
if self._figure is fig:
750750
return
751-
# if we currently have a figure (the case of both `self.figure`
751+
# if we currently have a figure (the case of both `self._figure`
752752
# and *fig* being none is taken care of above) we then user is
753753
# trying to change the figure an artist is associated with which
754754
# is not allowed for the same reason as adding the same instance
755755
# to more than one Axes
756-
if self.figure is not None:
756+
if self._figure is not None:
757757
raise RuntimeError("Can not put single artist in "
758758
"more than one figure")
759-
self.figure = fig
760-
if self.figure and self.figure is not self:
759+
self._figure = fig
760+
if self._figure and self._figure is not self:
761761
self.pchanged()
762762
self.stale = True
763763

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ def inset_axes(self, bounds, *, transform=None, zorder=5, **kwargs):
406406
# This puts the rectangle into figure-relative coordinates.
407407
inset_locator = _TransformedBoundsLocator(bounds, transform)
408408
bounds = inset_locator(self, None).bounds
409-
projection_class, pkw = self.figure._process_projection_requirements(**kwargs)
410-
inset_ax = projection_class(self.figure, bounds, zorder=zorder, **pkw)
409+
projection_class, pkw = self._figure._process_projection_requirements(**kwargs)
410+
inset_ax = projection_class(self._figure, bounds, zorder=zorder, **pkw)
411411

412412
# this locator lets the axes move if in data coordinates.
413413
# it gets called in `ax.apply_aspect() (of all places)
@@ -515,7 +515,7 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None,
515515

516516
# decide which two of the lines to keep visible....
517517
pos = inset_ax.get_position()
518-
bboxins = pos.transformed(self.figure.transSubfigure)
518+
bboxins = pos.transformed(self._figure.transSubfigure)
519519
rectbbox = mtransforms.Bbox.from_bounds(
520520
*bounds
521521
).transformed(transform)

lib/matplotlib/axes/_base.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def __call__(self, ax, renderer):
115115
# time as transSubfigure may otherwise change after this is evaluated.
116116
return mtransforms.TransformedBbox(
117117
mtransforms.Bbox.from_bounds(*self._bounds),
118-
self._transform - ax.figure.transSubfigure)
118+
self._transform - ax._figure.transSubfigure)
119119

120120

121121
def _process_plot_format(fmt, *, ambiguous_fmt_datakey=False):
@@ -787,7 +787,7 @@ def get_subplotspec(self):
787787
def set_subplotspec(self, subplotspec):
788788
"""Set the `.SubplotSpec`. associated with the subplot."""
789789
self._subplotspec = subplotspec
790-
self._set_position(subplotspec.get_position(self.figure))
790+
self._set_position(subplotspec.get_position(self._figure))
791791

792792
def get_gridspec(self):
793793
"""Return the `.GridSpec` associated with the subplot, or None."""
@@ -959,7 +959,7 @@ def get_xaxis_text1_transform(self, pad_points):
959959
labels_align = mpl.rcParams["xtick.alignment"]
960960
return (self.get_xaxis_transform(which='tick1') +
961961
mtransforms.ScaledTranslation(0, -1 * pad_points / 72,
962-
self.figure.dpi_scale_trans),
962+
self._figure.dpi_scale_trans),
963963
"top", labels_align)
964964

965965
def get_xaxis_text2_transform(self, pad_points):
@@ -985,7 +985,7 @@ def get_xaxis_text2_transform(self, pad_points):
985985
labels_align = mpl.rcParams["xtick.alignment"]
986986
return (self.get_xaxis_transform(which='tick2') +
987987
mtransforms.ScaledTranslation(0, pad_points / 72,
988-
self.figure.dpi_scale_trans),
988+
self._figure.dpi_scale_trans),
989989
"bottom", labels_align)
990990

991991
def get_yaxis_transform(self, which='grid'):
@@ -1039,7 +1039,7 @@ def get_yaxis_text1_transform(self, pad_points):
10391039
labels_align = mpl.rcParams["ytick.alignment"]
10401040
return (self.get_yaxis_transform(which='tick1') +
10411041
mtransforms.ScaledTranslation(-1 * pad_points / 72, 0,
1042-
self.figure.dpi_scale_trans),
1042+
self._figure.dpi_scale_trans),
10431043
labels_align, "right")
10441044

10451045
def get_yaxis_text2_transform(self, pad_points):
@@ -1065,7 +1065,7 @@ def get_yaxis_text2_transform(self, pad_points):
10651065
labels_align = mpl.rcParams["ytick.alignment"]
10661066
return (self.get_yaxis_transform(which='tick2') +
10671067
mtransforms.ScaledTranslation(pad_points / 72, 0,
1068-
self.figure.dpi_scale_trans),
1068+
self._figure.dpi_scale_trans),
10691069
labels_align, "left")
10701070

10711071
def _update_transScale(self):
@@ -1172,7 +1172,7 @@ def get_axes_locator(self):
11721172

11731173
def _set_artist_props(self, a):
11741174
"""Set the boilerplate props for artists added to Axes."""
1175-
a.set_figure(self.figure)
1175+
a.set_figure(self._figure)
11761176
if not a.is_transform_set():
11771177
a.set_transform(self.transData)
11781178

@@ -1295,7 +1295,7 @@ def __clear(self):
12951295
self._gridOn = mpl.rcParams['axes.grid']
12961296
old_children, self._children = self._children, []
12971297
for chld in old_children:
1298-
chld.axes = chld.figure = None
1298+
chld.axes = chld._figure = None
12991299
self._mouseover_set = _OrderedSet()
13001300
self.child_axes = []
13011301
self._current_image = None # strictly for pyplot via _sci, _gci
@@ -1346,7 +1346,7 @@ def __clear(self):
13461346
# the other artists. We use the frame to draw the edges so we are
13471347
# setting the edgecolor to None.
13481348
self.patch = self._gen_axes_patch()
1349-
self.patch.set_figure(self.figure)
1349+
self.patch.set_figure(self._figure)
13501350
self.patch.set_facecolor(self._facecolor)
13511351
self.patch.set_edgecolor('none')
13521352
self.patch.set_linewidth(0)
@@ -1521,7 +1521,7 @@ def _set_title_offset_trans(self, title_offset_points):
15211521
"""
15221522
self.titleOffsetTrans = mtransforms.ScaledTranslation(
15231523
0.0, title_offset_points / 72,
1524-
self.figure.dpi_scale_trans)
1524+
self._figure.dpi_scale_trans)
15251525
for _title in (self.title, self._left_title, self._right_title):
15261526
_title.set_transform(self.transAxes + self.titleOffsetTrans)
15271527
_title.set_clip_box(None)
@@ -2246,7 +2246,7 @@ def add_child_axes(self, ax):
22462246

22472247
self.child_axes.append(ax)
22482248
ax._remove_method = functools.partial(
2249-
self.figure._remove_axes, owners=[self.child_axes])
2249+
self._figure._remove_axes, owners=[self.child_axes])
22502250
self.stale = True
22512251
return ax
22522252

@@ -2990,7 +2990,7 @@ def _update_title_position(self, renderer):
29902990
axs = set()
29912991
axs.update(self.child_axes)
29922992
axs.update(self._twinned_axes.get_siblings(self))
2993-
axs.update(self.figure._align_label_groups['title'].get_siblings(self))
2993+
axs.update(self._figure._align_label_groups['title'].get_siblings(self))
29942994

29952995
for ax in self.child_axes: # Child positions must be updated first.
29962996
locator = ax.get_axes_locator()
@@ -3076,7 +3076,7 @@ def draw(self, renderer):
30763076
for _axis in self._axis_map.values():
30773077
artists.remove(_axis)
30783078

3079-
if not self.figure.canvas.is_saving():
3079+
if not self._figure.canvas.is_saving():
30803080
artists = [
30813081
a for a in artists
30823082
if not a.get_animated() or isinstance(a, mimage.AxesImage)]
@@ -3104,10 +3104,10 @@ def draw(self, renderer):
31043104
artists = [self.patch] + artists
31053105

31063106
if artists_rasterized:
3107-
_draw_rasterized(self.figure, artists_rasterized, renderer)
3107+
_draw_rasterized(self._figure, artists_rasterized, renderer)
31083108

31093109
mimage._draw_list_compositing_images(
3110-
renderer, self, artists, self.figure.suppressComposite)
3110+
renderer, self, artists, self._figure.suppressComposite)
31113111

31123112
renderer.close_group('axes')
31133113
self.stale = False
@@ -3116,7 +3116,7 @@ def draw_artist(self, a):
31163116
"""
31173117
Efficiently redraw a single artist.
31183118
"""
3119-
a.draw(self.figure.canvas.get_renderer())
3119+
a.draw(self._figure.canvas.get_renderer())
31203120

31213121
def redraw_in_frame(self):
31223122
"""
@@ -3126,7 +3126,7 @@ def redraw_in_frame(self):
31263126
for artist in [*self._axis_map.values(),
31273127
self.title, self._left_title, self._right_title]:
31283128
stack.enter_context(artist._cm_set(visible=False))
3129-
self.draw(self.figure.canvas.get_renderer())
3129+
self.draw(self._figure.canvas.get_renderer())
31303130

31313131
# Axes rectangle characteristics
31323132

@@ -3988,7 +3988,7 @@ def format_coord(self, x, y):
39883988
"???" if y is None else self.format_ydata(y))
39893989
screen_xy = self.transData.transform((x, y))
39903990
xy_strs = []
3991-
# Retrieve twins in the order of self.figure.axes to sort tied zorders (which is
3991+
# Retrieve twins in the order of self._figure.axes to sort tied zorders (which is
39923992
# the common case) by the order in which they are added to the figure.
39933993
for ax in sorted(twins, key=attrgetter("zorder")):
39943994
data_x, data_y = ax.transData.inverted().transform(screen_xy)
@@ -4434,7 +4434,7 @@ def get_tightbbox(self, renderer=None, call_axes_locator=True,
44344434

44354435
bb = []
44364436
if renderer is None:
4437-
renderer = self.figure._get_renderer()
4437+
renderer = self._figure._get_renderer()
44384438

44394439
if not self.get_visible():
44404440
return None
@@ -4485,9 +4485,9 @@ def _make_twin_axes(self, *args, **kwargs):
44854485
raise ValueError("Twinned Axes may share only one axis")
44864486
ss = self.get_subplotspec()
44874487
if ss:
4488-
twin = self.figure.add_subplot(ss, *args, **kwargs)
4488+
twin = self._figure.add_subplot(ss, *args, **kwargs)
44894489
else:
4490-
twin = self.figure.add_axes(
4490+
twin = self._figure.add_axes(
44914491
self.get_position(True), *args, **kwargs,
44924492
axes_locator=_TransformedBoundsLocator(
44934493
[0, 0, 1, 1], self.transAxes))
@@ -4713,7 +4713,7 @@ def get_agg_filter(self):
47134713
return None
47144714

47154715
def __init__(self, figure, artists):
4716-
self.figure = figure
4716+
self._figure = figure
47174717
self.artists = artists
47184718

47194719
@martist.allow_rasterization

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ def __init__(self, parent, orientation, location, functions, transform=None,
2828
self._ticks_set = False
2929

3030
if self._orientation == 'x':
31-
super().__init__(self._parent.figure, [0, 1., 1, 0.0001], **kwargs)
31+
super().__init__(self._parent._figure, [0, 1., 1, 0.0001], **kwargs)
3232
self._axis = self.xaxis
3333
self._locstrings = ['top', 'bottom']
3434
self._otherstrings = ['left', 'right']
3535
else: # 'y'
36-
super().__init__(self._parent.figure, [0, 1., 0.0001, 1], **kwargs)
36+
super().__init__(self._parent._figure, [0, 1., 0.0001, 1], **kwargs)
3737
self._axis = self.yaxis
3838
self._locstrings = ['right', 'left']
3939
self._otherstrings = ['top', 'bottom']

0 commit comments

Comments
 (0)