@@ -485,31 +485,36 @@ class OutlineParams:
485485
486486 outline : bool
487487 outline_color : str | list [float ]
488- gap_size : float
489- bg_size : float
488+ linewidth : float
490489
491490
492491def _set_outline (
493492 size : float ,
494493 outline : bool = False ,
495- outline_width : tuple [ float , float ] = ( 0.3 , 0.05 ) ,
494+ outline_width : float = 1.5 ,
496495 outline_color : str | list [float ] = "#0000000ff" , # black, white
497496 ** kwargs : Any ,
498497) -> 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
505510 if (len (outline_color ) == 3 or len (outline_color ) == 4 ) and all (isinstance (c , float ) for c in outline_color ):
506511 outline_color = matplotlib .colors .to_hex (outline_color )
507512
508513 if outline :
509514 kwargs .pop ("edgecolor" , None ) # remove edge from kwargs if present
510515 kwargs .pop ("alpha" , None ) # remove alpha from kwargs if present
511516
512- return OutlineParams (outline , outline_color , gap_size , bg_size )
517+ return OutlineParams (outline , outline_color , outline_width )
513518
514519
515520def _get_subplots (num_images : int , ncols : int = 4 , width : int = 4 , height : int = 3 ) -> plt .Figure | plt .Axes :
0 commit comments