@@ -22,7 +22,7 @@ def polar(
2222 ax : plt .Axes = None ,
2323 directions : int = 36 ,
2424 value_bins : List [float ] = None ,
25- colors : list [str | tuple [float ] | Colormap ] = None , #set of colours to use for the value bins
25+ colours : list [str | tuple [float ] | Colormap ] = None , #set of colours to use for the value bins
2626 title : str = None ,
2727 legend : bool = True ,
2828 ylim : tuple [float ] = None ,
@@ -57,7 +57,7 @@ def polar(
5757 label (bool, optional):
5858 Set to False to remove the bin labels. Defaults to False.
5959 density (bool, optional):
60- Set to False to see the sum of the values instead of their frequency
60+ Set to False to see the sum of the values instead of their frequency density
6161 Returns:
6262 plt.Axes: The axes object.
6363 """
@@ -76,17 +76,17 @@ def polar(
7676 )
7777
7878 # set colors
79- if colors is None :
80- colors = [
79+ if colours is None :
80+ colours = [
8181 to_hex (plt .get_cmap ("viridis" )(i ))
8282 for i in np .linspace (0 , 1 , len (binned .columns ))
8383 ]
84- if isinstance (colors , str ):
85- colors = plt .get_cmap (colors )
86- if isinstance (colors , Colormap ):
87- colors = [to_hex (colors (i )) for i in np .linspace (0 , 1 , len (binned .columns ))]
88- if isinstance (colors , list | tuple ):
89- if len (colors ) != len (binned .columns ):
84+ if isinstance (colours , str ):
85+ colours = plt .get_cmap (colours )
86+ if isinstance (colours , Colormap ):
87+ colours = [to_hex (colours (i )) for i in np .linspace (0 , 1 , len (binned .columns ))]
88+ if isinstance (colours , list | tuple ):
89+ if len (colours ) != len (binned .columns ):
9090 raise ValueError (
9191 f"colors must be a list of length { len (binned .columns )} , or a colormap."
9292 )
@@ -118,7 +118,7 @@ def polar(
118118 alpha = 1 ,
119119 )
120120 )
121- color_list .append (colors [n ])
121+ color_list .append (colours [n ])
122122 y += val
123123 if label :
124124 ax .text (x , y , f"{ y :0.1%} " , ha = "center" , va = "center" , fontsize = "x-small" )
@@ -131,7 +131,7 @@ def polar(
131131 # construct legend
132132 if legend :
133133 handles = [
134- mpatches .Patch (color = colors [n ], label = (f"{ i } to { j } " if str (j ) != str (np .inf ) else f"{ i } and above" ))
134+ mpatches .Patch (color = colours [n ], label = (f"{ i } to { j } " if str (j ) != str (np .inf ) else f"{ i } and above" ))
135135 for n , (i , j ) in enumerate (binned .columns .values )
136136 ]
137137 _ = ax .legend (
0 commit comments