@@ -485,31 +485,36 @@ class OutlineParams:
485
485
486
486
outline : bool
487
487
outline_color : str | list [float ]
488
- gap_size : float
489
- bg_size : float
488
+ linewidth : float
490
489
491
490
492
491
def _set_outline (
493
492
size : float ,
494
493
outline : bool = False ,
495
- outline_width : tuple [ float , float ] = ( 0.3 , 0.05 ) ,
494
+ outline_width : float = 1.5 ,
496
495
outline_color : str | list [float ] = "#0000000ff" , # black, white
497
496
** kwargs : Any ,
498
497
) -> OutlineParams :
499
- bg_width , gap_width = outline_width
500
- point = np .sqrt (size )
501
- gap_size = (point + (point * gap_width ) * 2 ) ** 2
502
- bg_size = (np .sqrt (gap_size ) + (point * bg_width ) * 2 ) ** 2
503
- # the default black and white colors can be changes using the contour_config parameter
504
-
498
+ # Type checks for outline_width
499
+ if isinstance (outline_width , int ):
500
+ outline_width = float (outline_width )
501
+ if not isinstance (outline_width , float ):
502
+ raise TypeError (f"Invalid type of `outline_width`: { type (outline_width )} , expected `float`." )
503
+ if outline_width == 0.0 :
504
+ outline = False
505
+ if outline_width < 0.0 :
506
+ logging .warning (f"Negative line widths are not allowed, changing { outline_width } to { (- 1 )* outline_width } " )
507
+ outline_width = (- 1 ) * outline_width
508
+
509
+ # the default black and white colors can be changed using the contour_config parameter
505
510
if (len (outline_color ) == 3 or len (outline_color ) == 4 ) and all (isinstance (c , float ) for c in outline_color ):
506
511
outline_color = matplotlib .colors .to_hex (outline_color )
507
512
508
513
if outline :
509
514
kwargs .pop ("edgecolor" , None ) # remove edge from kwargs if present
510
515
kwargs .pop ("alpha" , None ) # remove alpha from kwargs if present
511
516
512
- return OutlineParams (outline , outline_color , gap_size , bg_size )
517
+ return OutlineParams (outline , outline_color , outline_width )
513
518
514
519
515
520
def _get_subplots (num_images : int , ncols : int = 4 , width : int = 4 , height : int = 3 ) -> plt .Figure | plt .Axes :
0 commit comments