3535from matplotlib import rcParams
3636from patches import Patch , Rectangle , Circle , Polygon , Arrow , Wedge , Shadow , bbox_artist
3737from table import Table
38- from text import Text , _process_text_args
38+ from text import Text , TextWithDash , _process_text_args
3939from transforms import Bbox , Point , Value , Affine , NonseparableTransformation
4040from transforms import FuncXY , Func , LOG10 , IDENTITY , POLAR
4141from transforms import get_bbox_transform , unit_bbox , one , origin , zero
@@ -3403,7 +3403,8 @@ def table(self,
34033403 return table
34043404
34053405
3406- def text (self , x , y , s , fontdict = None , ** kwargs ):
3406+ def text (self , x , y , s , fontdict = None ,
3407+ withdash = False , ** kwargs ):
34073408 """
34083409 TEXT(x, y, s, fontdict=None, **kwargs)
34093410
@@ -3413,6 +3414,9 @@ def text(self, x, y, s, fontdict=None, **kwargs):
34133414 If fontdict is None, the defaults are determined by your rc
34143415 parameters.
34153416
3417+ withdash=True will create a TextWithDash instance instead
3418+ of a Text instance.
3419+
34163420 Individual keyword arguemnts can be used to override any given
34173421 parameter
34183422
@@ -3437,9 +3441,20 @@ def text(self, x, y, s, fontdict=None, **kwargs):
34373441 'transform' : self .transData ,
34383442 }
34393443
3440- t = Text (
3441- x = x , y = y , text = s ,
3442- )
3444+ # At some point if we feel confident that TextWithDash
3445+ # is robust as a drop-in replacement for Text and that
3446+ # the performance impact of the heavier-weight class
3447+ # isn't too significant, it may make sense to eliminate
3448+ # the withdash kwarg and simply delegate whether there's
3449+ # a dash to TextWithDash and dashlength.
3450+ if withdash :
3451+ t = TextWithDash (
3452+ x = x , y = y , text = s ,
3453+ )
3454+ else :
3455+ t = Text (
3456+ x = x , y = y , text = s ,
3457+ )
34433458 self ._set_artist_props (t )
34443459
34453460 t .update (default )
0 commit comments