Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d412228

Browse files
authored
Merge pull request #8772 from anntzer/backends-cleanup
MNT: Backends cleanup - style and docs in backend_bases and backend_agg - style in backend_cairo - dropped unused private attribute in backend_gtk3, backend_gtk3agg, backend_gtk3cairo - unified 'normal' and 'blitting' code paths in backend_qt5agg - import cleanup and MRO tweaks it backend_qt5agg - import tweaks + MRO cleanup in backend_qt4agg
2 parents c4e6388 + 79cfe14 commit d412228

9 files changed

+176
-321
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -694,17 +694,17 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath):
694694

695695
def get_text_width_height_descent(self, s, prop, ismath):
696696
"""
697-
get the width and height, and the offset from the bottom to the
698-
baseline (descent), in display coords of the string s with
699-
:class:`~matplotlib.font_manager.FontProperties` prop
697+
Get the width, height, and descent (offset from the bottom
698+
to the baseline), in display coords, of the string *s* with
699+
:class:`~matplotlib.font_manager.FontProperties` *prop*
700700
"""
701701
if ismath == 'TeX':
702702
# todo: handle props
703703
size = prop.get_size_in_points()
704704
texmanager = self._text2path.get_texmanager()
705705
fontsize = prop.get_size_in_points()
706-
w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
707-
renderer=self)
706+
w, h, d = texmanager.get_text_width_height_descent(
707+
s, fontsize, renderer=self)
708708
return w, h, d
709709

710710
dpi = self.points_to_pixels(72)
@@ -2151,7 +2151,6 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
21512151
# the backend to support file-like object, i'm going
21522152
# to leave it as it is. However, a better solution
21532153
# than stringIO seems to be needed. -JJL
2154-
#result = getattr(self, method_name)
21552154
result = print_method(
21562155
io.BytesIO(),
21572156
dpi=dpi,
@@ -2203,7 +2202,6 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
22032202
_bbox_inches_restore = None
22042203

22052204
try:
2206-
#result = getattr(self, method_name)(
22072205
result = print_method(
22082206
filename,
22092207
dpi=dpi,

lib/matplotlib/backends/backend_agg.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,17 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
212212

213213
def get_text_width_height_descent(self, s, prop, ismath):
214214
"""
215-
get the width and height in display coords of the string s
216-
with FontPropertry prop
217-
218-
# passing rgb is a little hack to make caching in the
219-
# texmanager more efficient. It is not meant to be used
220-
# outside the backend
215+
Get the width, height, and descent (offset from the bottom
216+
to the baseline), in display coords, of the string *s* with
217+
:class:`~matplotlib.font_manager.FontProperties` *prop*
221218
"""
222219
if rcParams['text.usetex']:
223220
# todo: handle props
224221
size = prop.get_size_in_points()
225222
texmanager = self.get_texmanager()
226223
fontsize = prop.get_size_in_points()
227-
w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
228-
renderer=self)
224+
w, h, d = texmanager.get_text_width_height_descent(
225+
s, fontsize, renderer=self)
229226
return w, h, d
230227

231228
if ismath:

0 commit comments

Comments
 (0)