@@ -53,18 +53,14 @@ def __init__(self, data, obj): # noqa: C901
53
53
xlabel = _common_texification (xlabel )
54
54
self .axis_options .append (f"xlabel={{{ xlabel } }}" )
55
55
if xrotation != 0 :
56
- self .axis_options .append (
57
- "xlabel style={{rotate={}}}" .format (xrotation - 90 )
58
- )
56
+ self .axis_options .append ("xlabel style={{rotate={xrotation - 90)}}}" )
59
57
ylabel = obj .get_ylabel ()
60
58
yrotation = obj .yaxis .get_label ().get_rotation ()
61
59
if ylabel :
62
60
ylabel = _common_texification (ylabel )
63
61
self .axis_options .append (f"ylabel={{{ ylabel } }}" )
64
62
if yrotation != 90 :
65
- self .axis_options .append (
66
- "ylabel style={{rotate={}}}" .format (yrotation - 90 )
67
- )
63
+ self .axis_options .append ("ylabel style={{rotate={yrotation - 90}}}" )
68
64
69
65
# Axes limits.
70
66
ff = data ["float format" ]
@@ -419,7 +415,7 @@ def _subplot(self, obj, data):
419
415
# subplotspec geometry positioning is 0-based
420
416
self .subplot_index = geom [2 ] + 1
421
417
if "is_in_groupplot_env" not in data or not data ["is_in_groupplot_env" ]:
422
- group_style = ["group size={} by {}" . format ( geom [1 ], geom [ 0 ]) ]
418
+ group_style = [f "group size={ geom [ 1 ] } by { geom [0 ] } " ]
423
419
group_style .extend (data ["extra groupstyle options [base]" ])
424
420
options = ["group style={{{}}}" .format (", " .join (group_style ))]
425
421
self .content .append (
@@ -462,12 +458,12 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
462
458
values = []
463
459
464
460
if any (tick_labels_rotation ) != 0 :
465
- values .append ("rotate={}" . format ( tick_labels_rotation [0 ]) )
461
+ values .append (f "rotate={ tick_labels_rotation [0 ]} " )
466
462
467
463
# Horizontal alignment will be ignored if no 'x/y tick label text width' has
468
464
# been passed in the 'extra' parameter
469
465
if tick_label_text_width :
470
- values .append ("align={}" . format ( tick_labels_horizontal_alignment [0 ]) )
466
+ values .append (f "align={ tick_labels_horizontal_alignment [0 ]} " )
471
467
values .append (f"text width={ tick_label_text_width } " )
472
468
473
469
if values :
@@ -478,7 +474,7 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
478
474
values = []
479
475
480
476
if tick_labels_rotation_same_value :
481
- values .append ("rotate={}" . format ( tick_labels_rotation [0 ]) )
477
+ values .append ("rotate={tick_labels_rotation[0]}" )
482
478
else :
483
479
values .append (
484
480
"rotate={{{},0}}[\\ ticknum]" .format (
@@ -490,20 +486,14 @@ def _get_label_rotation_and_horizontal_alignment(self, obj, data, x_or_y):
490
486
# passed in the 'extra' parameter
491
487
if tick_label_text_width :
492
488
if tick_labels_horizontal_alignment_same_value :
493
- values .append (
494
- "align={}" .format (tick_labels_horizontal_alignment [0 ])
495
- )
489
+ values .append (f"align={ tick_labels_horizontal_alignment [0 ]} " )
496
490
values .append (f"text width={ tick_label_text_width } " )
497
491
else :
498
492
for idx , x in enumerate (tick_labels_horizontal_alignment ):
499
- label_style += "{}_tick_label_ha_{}/.initial = {}" .format (
500
- x_or_y , idx , x
501
- )
493
+ label_style += f"{ x_or_y } _tick_label_ha_{ idx } /.initial = { x } "
502
494
503
495
values .append (
504
- "align=\\ pgfkeysvalueof{{/pgfplots/{}_tick_label_ha_\\ ticknum}}" .format (
505
- x_or_y
506
- )
496
+ f"align=\\ pgfkeysvalueof{{/pgfplots/{ x_or_y } _tick_label_ha_\\ ticknum}}"
507
497
)
508
498
values .append (f"text width={ tick_label_text_width } " )
509
499
@@ -777,10 +767,8 @@ def _handle_listed_color_map(cmap, data):
777
767
reps = int (float (cmap .N ) / len (cmap .colors ) - 0.5 ) + 1
778
768
repeated_cols = reps * cmap .colors
779
769
colors = [
780
- ("rgb({}{})=(" + ff + "," + ff + "," + ff + ")" ).format (
781
- k , unit , rgb [0 ], rgb [1 ], rgb [2 ]
782
- )
783
- for (k , rgb ) in enumerate (repeated_cols [: cmap .N ])
770
+ "rgb({k}{unit})=({rgb[0]:{ff}},{rgb[1]:{ff}},{rgb[2]:{ff}})"
771
+ for k , rgb in enumerate (repeated_cols [: cmap .N ])
784
772
]
785
773
colormap_string = "{{mymap}}{{[1{}]\n {}\n }}" .format (unit , ";\n " .join (colors ))
786
774
is_custom_colormap = True
0 commit comments