@@ -44,14 +44,14 @@ def __init__(self, data, obj): # noqa: C901
4444 data ["current axis title" ] = title
4545 if title :
4646 title = _common_texification (title )
47- self .axis_options .append ("title={{{}}}" . format ( title ) )
47+ self .axis_options .append (f "title={{{ title } }}" )
4848
4949 # get axes titles
5050 xlabel = obj .get_xlabel ()
5151 xrotation = obj .xaxis .get_label ().get_rotation ()
5252 if xlabel :
5353 xlabel = _common_texification (xlabel )
54- self .axis_options .append ("xlabel={{{}}}" . format ( xlabel ) )
54+ self .axis_options .append (f "xlabel={{{ xlabel } }}" )
5555 if xrotation != 0 :
5656 self .axis_options .append (
5757 "xlabel style={{rotate={}}}" .format (xrotation - 90 )
@@ -60,7 +60,7 @@ def __init__(self, data, obj): # noqa: C901
6060 yrotation = obj .yaxis .get_label ().get_rotation ()
6161 if ylabel :
6262 ylabel = _common_texification (ylabel )
63- self .axis_options .append ("ylabel={{{}}}" . format ( ylabel ) )
63+ self .axis_options .append (f "ylabel={{{ ylabel } }}" )
6464 if yrotation != 90 :
6565 self .axis_options .append (
6666 "ylabel style={{rotate={}}}" .format (yrotation - 90 )
@@ -131,14 +131,14 @@ def __init__(self, data, obj): # noqa: C901
131131 axcol = obj .spines ["bottom" ].get_edgecolor ()
132132 data , col , _ = _color .mpl_color2xcolor (data , axcol )
133133 if col != "black" :
134- self .axis_options .append ("axis line style={{{}}}" . format ( col ) )
134+ self .axis_options .append (f "axis line style={{{ col } }}" )
135135
136136 # background color
137137 bgcolor = obj .get_facecolor ()
138138
139139 data , col , _ = _color .mpl_color2xcolor (data , bgcolor )
140140 if col != "white" :
141- self .axis_options .append ("axis background/.style={{fill={}}}" . format ( col ) )
141+ self .axis_options .append (f "axis background/.style={{fill={ col } }}" )
142142
143143 # find color bar
144144 colorbar = _find_associated_colorbar (obj )
@@ -229,7 +229,7 @@ def _ticks(self, data, obj):
229229 else :
230230 c0 = l0 .get_color ()
231231 data , xtickcolor , _ = _color .mpl_color2xcolor (data , c0 )
232- self .axis_options .append ("xtick style={{color={}}}" . format ( xtickcolor ) )
232+ self .axis_options .append (f "xtick style={{color={ xtickcolor } }}" )
233233
234234 try :
235235 l0 = obj .get_yticklines ()[0 ]
@@ -238,7 +238,7 @@ def _ticks(self, data, obj):
238238 else :
239239 c0 = l0 .get_color ()
240240 data , ytickcolor , _ = _color .mpl_color2xcolor (data , c0 )
241- self .axis_options .append ("ytick style={{color={}}}" . format ( ytickcolor ) )
241+ self .axis_options .append (f "ytick style={{color={ ytickcolor } }}" )
242242
243243 # Find tick direction
244244 # For new matplotlib versions, we could replace the direction getter by
@@ -286,7 +286,7 @@ def _ticks(self, data, obj):
286286 y_tick_position_string , y_tick_position = _get_tick_position (obj , "y" )
287287
288288 if x_tick_position == y_tick_position and x_tick_position is not None :
289- self .axis_options .append ("tick pos={}" . format ( x_tick_position ) )
289+ self .axis_options .append (f "tick pos={ x_tick_position } " )
290290 else :
291291 self .axis_options .append (x_tick_position_string )
292292 self .axis_options .append (y_tick_position_string )
@@ -307,7 +307,7 @@ def _grid(self, obj, data):
307307 xgridcolor = xlines [0 ].get_color ()
308308 data , col , _ = _color .mpl_color2xcolor (data , xgridcolor )
309309 if col != "black" :
310- self .axis_options .append ("x grid style={{{}}}" . format ( col ) )
310+ self .axis_options .append (f "x grid style={{{ col } }}" )
311311
312312 if obj .yaxis ._gridOnMajor :
313313 self .axis_options .append ("ymajorgrids" )
@@ -319,7 +319,7 @@ def _grid(self, obj, data):
319319 ygridcolor = ylines [0 ].get_color ()
320320 data , col , _ = _color .mpl_color2xcolor (data , ygridcolor )
321321 if col != "black" :
322- self .axis_options .append ("y grid style={{{}}}" . format ( col ) )
322+ self .axis_options .append (f "y grid style={{{ col } }}" )
323323
324324 return
325325
@@ -435,7 +435,7 @@ def _subplot(self, obj, data):
435435
436436 def _get_label_rotation_and_horizontal_alignment (self , obj , data , x_or_y ):
437437 tick_label_text_width = None
438- tick_label_text_width_identifier = "{ } tick label text width". format ( x_or_y )
438+ tick_label_text_width_identifier = f" { x_or_y } tick label text width"
439439 if tick_label_text_width_identifier in self .axis_options :
440440 self .axis_options .remove (tick_label_text_width_identifier )
441441
@@ -473,7 +473,7 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
473473 # been passed in the 'extra' parameter
474474 if tick_label_text_width :
475475 values .append ("align={}" .format (tick_labels_horizontal_alignment [0 ]))
476- values .append ("text width={}" . format ( tick_label_text_width ) )
476+ values .append (f "text width={ tick_label_text_width } " )
477477
478478 if values :
479479 label_style = "{}ticklabel style = {{{}}}" .format (
@@ -498,7 +498,7 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
498498 values .append (
499499 "align={}" .format (tick_labels_horizontal_alignment [0 ])
500500 )
501- values .append ("text width={}" . format ( tick_label_text_width ) )
501+ values .append (f "text width={ tick_label_text_width } " )
502502 else :
503503 for idx , x in enumerate (tick_labels_horizontal_alignment ):
504504 label_style += "{}_tick_label_ha_{}/.initial = {}" .format (
@@ -510,7 +510,7 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
510510 x_or_y
511511 )
512512 )
513- values .append ("text width={}" . format ( tick_label_text_width ) )
513+ values .append (f "text width={ tick_label_text_width } " )
514514
515515 label_style = (
516516 "every {} tick label/.style = {{\n "
@@ -537,7 +537,7 @@ def _get_tick_position(obj, axes_obj):
537537
538538 major_ticks_position = None
539539 if not major_ticks_bottom_show_all and not major_ticks_top_show_all :
540- position_string = "{ }majorticks=false". format ( axes_obj )
540+ position_string = f" { axes_obj } majorticks=false"
541541 elif major_ticks_bottom_show_all and major_ticks_top_show_all :
542542 major_ticks_position = "both"
543543 elif major_ticks_bottom_show_all :
@@ -546,7 +546,7 @@ def _get_tick_position(obj, axes_obj):
546546 major_ticks_position = "right"
547547
548548 if major_ticks_position :
549- position_string = "{ }tick pos={}" . format ( axes_obj , major_ticks_position )
549+ position_string = f" { axes_obj } tick pos={ major_ticks_position } "
550550
551551 return position_string , major_ticks_position
552552
@@ -593,7 +593,7 @@ def _get_ticks(data, xy, ticks, ticklabels):
593593 )
594594 else :
595595 val = "{}" if "minor" in xy else "\\ empty"
596- axis_options .append ("{ }tick={}" . format ( xy , val ) )
596+ axis_options .append (f" { xy } tick={ val } " )
597597
598598 if is_label_required :
599599 axis_options .append (
0 commit comments