159159from matplotlib import _pylab_helpers , cbook
160160
161161matplotlib .use ("agg" )
162- align = Image .align
162+ align = cbook .deprecated (
163+ "3.4" , alternative = "docutils.parsers.rst.directives.images.Image.align" )(
164+ Image .align )
163165
164166__version__ = 2
165167
@@ -191,11 +193,6 @@ def _option_format(arg):
191193 return directives .choice (arg , ('python' , 'doctest' ))
192194
193195
194- def _option_align (arg ):
195- return directives .choice (arg , ("top" , "middle" , "bottom" , "left" , "center" ,
196- "right" ))
197-
198-
199196def mark_plot_labels (app , document ):
200197 """
201198 To make plots referenceable, we need to move the reference from the
@@ -238,7 +235,7 @@ class PlotDirective(Directive):
238235 'height' : directives .length_or_unitless ,
239236 'width' : directives .length_or_percentage_or_unitless ,
240237 'scale' : directives .nonnegative_int ,
241- 'align' : _option_align ,
238+ 'align' : Image . align ,
242239 'class' : directives .class_option ,
243240 'include-source' : _option_boolean ,
244241 'format' : _option_format ,
@@ -258,7 +255,6 @@ def run(self):
258255
259256
260257def setup (app ):
261- import matplotlib
262258 setup .app = app
263259 setup .config = app .config
264260 setup .confdir = app .confdir
0 commit comments