28
28
import numpy as np
29
29
from collections import OrderedDict
30
30
from math import radians , cos , sin
31
- from matplotlib import rcParams , __version__
31
+ from matplotlib import cbook , rcParams , __version__
32
32
from matplotlib .backend_bases import (
33
33
_Backend , FigureCanvasBase , FigureManagerBase , RendererBase , cursors )
34
34
from matplotlib .figure import Figure
@@ -68,7 +68,11 @@ class RendererAgg(RendererBase):
68
68
The renderer handles all the drawing primitives using a graphics
69
69
context instance that controls the colors/styles
70
70
"""
71
- debug = 1
71
+
72
+ @property
73
+ @cbook .deprecated ("2.2" )
74
+ def debug (self ):
75
+ return 1
72
76
73
77
# we want to cache the fonts at the class level so that when
74
78
# multiple figures are created we can reuse them. This helps with
@@ -79,16 +83,17 @@ class RendererAgg(RendererBase):
79
83
# draw, and release it when it is done. This allows multiple
80
84
# renderers to share the cached fonts, but only one figure can
81
85
# draw at time and so the font cache is used by only one
82
- # renderer at a time
86
+ # renderer at a time.
83
87
84
88
lock = threading .RLock ()
89
+
85
90
def __init__ (self , width , height , dpi ):
86
91
RendererBase .__init__ (self )
87
92
88
93
self .dpi = dpi
89
94
self .width = width
90
95
self .height = height
91
- self ._renderer = _RendererAgg (int (width ), int (height ), dpi , debug = False )
96
+ self ._renderer = _RendererAgg (int (width ), int (height ), dpi )
92
97
self ._filter_renderers = []
93
98
94
99
self ._update_methods ()
@@ -158,12 +163,14 @@ def draw_path(self, gc, path, transform, rgbFace=None):
158
163
try :
159
164
self ._renderer .draw_path (gc , p , transform , rgbFace )
160
165
except OverflowError :
161
- raise OverflowError ("Exceeded cell block limit (set 'agg.path.chunksize' rcparam)" )
166
+ raise OverflowError ("Exceeded cell block limit (set "
167
+ "'agg.path.chunksize' rcparam)" )
162
168
else :
163
169
try :
164
170
self ._renderer .draw_path (gc , path , transform , rgbFace )
165
171
except OverflowError :
166
- raise OverflowError ("Exceeded cell block limit (set 'agg.path.chunksize' rcparam)" )
172
+ raise OverflowError ("Exceeded cell block limit (set "
173
+ "'agg.path.chunksize' rcparam)" )
167
174
168
175
169
176
def draw_mathtext (self , gc , x , y , s , prop , angle ):
@@ -232,8 +239,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
232
239
233
240
flags = get_hinting_flag ()
234
241
font = self ._get_agg_font (prop )
235
- font .set_text (s , 0.0 , flags = flags ) # the width and height of unrotated string
236
- w , h = font .get_width_height ()
242
+ font .set_text (s , 0.0 , flags = flags )
243
+ w , h = font .get_width_height () # width and height of unrotated string
237
244
d = font .get_descent ()
238
245
w /= 64.0 # convert from subpixels
239
246
h /= 64.0
@@ -367,9 +374,8 @@ def post_processing(image, dpi):
367
374
post_processing is plotted (using draw_image) on it.
368
375
"""
369
376
370
- # WARNING.
371
- # For agg_filter to work, the rendere's method need
372
- # to overridden in the class. See draw_markers, and draw_path_collections
377
+ # WARNING: For agg_filter to work, the renderer's method need to
378
+ # overridden in the class. See draw_markers and draw_path_collections.
373
379
374
380
width , height = int (self .width ), int (self .height )
375
381
0 commit comments