@@ -252,8 +252,8 @@ def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
252252# use an integer format on the annotations and provide some colors.
253253
254254data = np .random .randint (2 , 100 , size = (7 , 7 ))
255- y = ["Book {}" . format ( i ) for i in range (1 , 8 )]
256- x = ["Store {}" . format ( i ) for i in list ("ABCDEFG" )]
255+ y = [f "Book { i } " for i in range (1 , 8 )]
256+ x = [f "Store { i } " for i in list ("ABCDEFG" )]
257257im , _ = heatmap (data , y , x , ax = ax2 , vmin = 0 ,
258258 cmap = "magma_r" , cbarlabel = "weekly sold copies" )
259259annotate_heatmap (im , valfmt = "{x:d}" , size = 7 , threshold = 20 ,
@@ -265,8 +265,8 @@ def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
265265# labels from an array of classes.
266266
267267data = np .random .randn (6 , 6 )
268- y = ["Prod. {}" . format ( i ) for i in range (10 , 70 , 10 )]
269- x = ["Cycle {}" . format ( i ) for i in range (1 , 7 )]
268+ y = [f "Prod. { i } " for i in range (10 , 70 , 10 )]
269+ x = [f "Cycle { i } " for i in range (1 , 7 )]
270270
271271qrates = list ("ABCDEFG" )
272272norm = matplotlib .colors .BoundaryNorm (np .linspace (- 3.5 , 3.5 , 8 ), 7 )
@@ -292,7 +292,7 @@ def annotate_heatmap(im, data=None, valfmt="{x:.2f}",
292292
293293
294294def func (x , pos ):
295- return "{ :.2f}". format ( x ) .replace ("0." , "." ).replace ("1.00" , "" )
295+ return f" { x :.2f} " .replace ("0." , "." ).replace ("1.00" , "" )
296296
297297annotate_heatmap (im , valfmt = matplotlib .ticker .FuncFormatter (func ), size = 7 )
298298
0 commit comments