@@ -118,11 +118,9 @@ def draw_text(data, obj):
118
118
# We might want to remove this here in the future.
119
119
text = text .replace ("\n " , "\\ \\ " )
120
120
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 " )
126
124
return data , content
127
125
128
126
@@ -139,7 +137,8 @@ def _transform_positioning(ha, va):
139
137
"center" : "" ,
140
138
"baseline" : "base" ,
141
139
}
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 } "
143
142
144
143
145
144
def _parse_annotation_coords (ff , coords , xy ):
@@ -229,7 +228,7 @@ def _annotation(obj, data, content):
229
228
230
229
if obj .arrow_patch :
231
230
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 "
233
232
content .append (the_arrow )
234
233
return text_pos
235
234
@@ -285,12 +284,11 @@ def _bbox(bbox, data, properties, scaling):
285
284
# pattern from matplotlib instead of hardcoding
286
285
# an approximation?
287
286
elif bbox .get_ls () == "dashdot" :
287
+ s1 = 1.0 / scaling
288
+ s3 = 3.0 / scaling
289
+ s6 = 6.0 / scaling
288
290
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"
292
292
)
293
293
else :
294
294
assert bbox .get_ls () == "solid"
295
-
296
- return
0 commit comments