@@ -118,11 +118,9 @@ def draw_text(data, obj):
118118 # We might want to remove this here in the future.
119119 text = text .replace ("\n " , "\\ \\ " )
120120
121- content .append (
122- "\\ draw {pos} node[\n {props}\n ]{{{text}}};\n " .format (
123- pos = tikz_pos , props = ",\n " .join (properties ), text = " " .join (style + [text ])
124- )
125- )
121+ props = ",\n " .join (properties )
122+ text = " " .join (style + [text ])
123+ content .append (f"\\ draw { tikz_pos } node[\n { props } \n ]{{{ text } }};\n " )
126124 return data , content
127125
128126
@@ -139,7 +137,8 @@ def _transform_positioning(ha, va):
139137 "center" : "" ,
140138 "baseline" : "base" ,
141139 }
142- return "anchor={} {}" .format (va_mpl_to_tikz [va ], ha_mpl_to_tikz [ha ]).strip ()
140+ anchor = " " .join ([va_mpl_to_tikz [va ], ha_mpl_to_tikz [ha ]]).strip ()
141+ return f"anchor={ anchor } "
143142
144143
145144def _parse_annotation_coords (ff , coords , xy ):
@@ -229,7 +228,7 @@ def _annotation(obj, data, content):
229228
230229 if obj .arrow_patch :
231230 style = "," .join (_get_arrow_style (obj .arrow_patch , data ))
232- the_arrow = ( "\\ draw[{}] {} -- {};\n " ). format ( style , text_pos , xy_pos )
231+ the_arrow = f "\\ draw[{ style } ] { text_pos } -- { xy_pos } ;\n "
233232 content .append (the_arrow )
234233 return text_pos
235234
@@ -285,12 +284,11 @@ def _bbox(bbox, data, properties, scaling):
285284 # pattern from matplotlib instead of hardcoding
286285 # an approximation?
287286 elif bbox .get_ls () == "dashdot" :
287+ s1 = 1.0 / scaling
288+ s3 = 3.0 / scaling
289+ s6 = 6.0 / scaling
288290 properties .append (
289- "dash pattern=on {:.3g}pt off {:.3g}pt on {:.3g}pt off {:.3g}pt" .format (
290- 1.0 / scaling , 3.0 / scaling , 6.0 / scaling , 3.0 / scaling
291- )
291+ f"dash pattern=on { s1 :.3g} pt off { s3 :.3g} pt on { s6 :.3g} pt off { s3 :.3g} pt"
292292 )
293293 else :
294294 assert bbox .get_ls () == "solid"
295-
296- return
0 commit comments