2828import numpy as np
2929from collections import OrderedDict
3030from math import radians , cos , sin
31- from matplotlib import rcParams , __version__
31+ from matplotlib import cbook , rcParams , __version__
3232from matplotlib .backend_bases import (
3333 _Backend , FigureCanvasBase , FigureManagerBase , RendererBase , cursors )
3434from matplotlib .figure import Figure
@@ -68,7 +68,11 @@ class RendererAgg(RendererBase):
6868 The renderer handles all the drawing primitives using a graphics
6969 context instance that controls the colors/styles
7070 """
71- debug = 1
71+
72+ @property
73+ @cbook .deprecated ("2.2" )
74+ def debug (self ):
75+ return 1
7276
7377 # we want to cache the fonts at the class level so that when
7478 # multiple figures are created we can reuse them. This helps with
@@ -79,16 +83,17 @@ class RendererAgg(RendererBase):
7983 # draw, and release it when it is done. This allows multiple
8084 # renderers to share the cached fonts, but only one figure can
8185 # draw at time and so the font cache is used by only one
82- # renderer at a time
86+ # renderer at a time.
8387
8488 lock = threading .RLock ()
89+
8590 def __init__ (self , width , height , dpi ):
8691 RendererBase .__init__ (self )
8792
8893 self .dpi = dpi
8994 self .width = width
9095 self .height = height
91- self ._renderer = _RendererAgg (int (width ), int (height ), dpi , debug = False )
96+ self ._renderer = _RendererAgg (int (width ), int (height ), dpi )
9297 self ._filter_renderers = []
9398
9499 self ._update_methods ()
@@ -158,12 +163,14 @@ def draw_path(self, gc, path, transform, rgbFace=None):
158163 try :
159164 self ._renderer .draw_path (gc , p , transform , rgbFace )
160165 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)" )
162168 else :
163169 try :
164170 self ._renderer .draw_path (gc , path , transform , rgbFace )
165171 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)" )
167174
168175
169176 def draw_mathtext (self , gc , x , y , s , prop , angle ):
@@ -232,8 +239,8 @@ def get_text_width_height_descent(self, s, prop, ismath):
232239
233240 flags = get_hinting_flag ()
234241 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
237244 d = font .get_descent ()
238245 w /= 64.0 # convert from subpixels
239246 h /= 64.0
@@ -367,9 +374,8 @@ def post_processing(image, dpi):
367374 post_processing is plotted (using draw_image) on it.
368375 """
369376
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.
373379
374380 width , height = int (self .width ), int (self .height )
375381
0 commit comments