11
11
from matplotlib import docstring
12
12
from matplotlib .patches import Circle
13
13
from matplotlib .path import Path
14
- from matplotlib .ticker import Formatter , Locator
14
+ from matplotlib .ticker import Formatter , Locator , FormatStrFormatter
15
15
from matplotlib .transforms import Affine2D , Affine2DBase , Bbox , \
16
16
BboxTransformTo , IdentityTransform , Transform , TransformWrapper
17
17
import matplotlib .spines as mspines
@@ -318,7 +318,7 @@ def set_yscale(self, *args, **kwargs):
318
318
set_rticks = Axes .set_yticks
319
319
320
320
@docstring .dedent_interpd
321
- def set_thetagrids (self , angles , labels = None , frac = None ,
321
+ def set_thetagrids (self , angles , labels = None , frac = None , fmt = None ,
322
322
** kwargs ):
323
323
"""
324
324
Set the angles at which to place the theta grids (these
@@ -348,6 +348,8 @@ def set_thetagrids(self, angles, labels=None, frac=None,
348
348
self .set_xticks (angles * (npy .pi / 180.0 ))
349
349
if labels is not None :
350
350
self .set_xticklabels (labels )
351
+ elif fmt is not None :
352
+ self .xaxis .set_major_formatter (FormatStrFormatter (fmt ))
351
353
if frac is not None :
352
354
self ._theta_label1_position .clear ().translate (0.0 , frac )
353
355
self ._theta_label2_position .clear ().translate (0.0 , 1.0 / frac )
@@ -356,7 +358,8 @@ def set_thetagrids(self, angles, labels=None, frac=None,
356
358
return self .xaxis .get_ticklines (), self .xaxis .get_ticklabels ()
357
359
358
360
@docstring .dedent_interpd
359
- def set_rgrids (self , radii , labels = None , angle = None , rpad = None , ** kwargs ):
361
+ def set_rgrids (self , radii , labels = None , angle = None , rpad = None , fmt = None ,
362
+ ** kwargs ):
360
363
"""
361
364
Set the radial locations and labels of the *r* grids.
362
365
@@ -389,6 +392,8 @@ def set_rgrids(self, radii, labels=None, angle=None, rpad=None, **kwargs):
389
392
self .set_yticks (radii )
390
393
if labels is not None :
391
394
self .set_yticklabels (labels )
395
+ elif fmt is not None :
396
+ self .yaxis .set_major_formatter (FormatStrFormatter (fmt ))
392
397
if angle is None :
393
398
angle = self ._r_label1_position .to_values ()[4 ]
394
399
if rpad is not None :
0 commit comments