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

Skip to content

Commit 79cfe14

Browse files
committed
And some more cleanups.
The removed comment in backend_agg regarding rgb came in in 281b7b7, but is now irrelevant.
1 parent 6d2380e commit 79cfe14

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
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:

lib/matplotlib/backends/backend_cairo.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -549,18 +549,6 @@ def _save(self, fo, fmt, **kwargs):
549549

550550
self.figure.draw(renderer)
551551

552-
show_fig_border = False # for testing figure orientation and scaling
553-
if show_fig_border:
554-
ctx.new_path()
555-
ctx.rectangle(0, 0, width_in_points, height_in_points)
556-
ctx.set_line_width(4.0)
557-
ctx.set_source_rgb(1,0,0)
558-
ctx.stroke()
559-
ctx.move_to(30,30)
560-
ctx.select_font_face('sans-serif')
561-
ctx.set_font_size(20)
562-
ctx.show_text('Origin corner')
563-
564552
ctx.show_page()
565553
surface.finish()
566554
if fmt == 'svgz':

0 commit comments

Comments
 (0)