Every line of 'seaborn hue order' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
229 def _get_hue_column(self): 230 """ 231 This internal function limits the available columns for hue selection. 232 It filters out those columns with too many dinstinct values. 233 234 Currently it is set for the number 6, which is the number of distinct 235 colors for the default seaborn color palette. 236 237 Args: None 238 239 Returns: 240 hue_columns --> list: a list of column headers 241 """ 242 243 hue_columns = [] 244 for column in self.available_columns: 245 if self.df[column].nunique() <= 6: 246 # Restrict hue selection based on distinct values in column 247 hue_columns.append(column) 248 249 return hue_columns
60 def get_hues(self, data): 61 base, _, rev = self.palette.partition("_") 62 n = len(data) 63 pal = self.get_palette() 64 if self._reversed: 65 pal = pal[::-1] 66 return (pal * ((n // self.ncol) + 1))[:n]
70 def test_get_hues_by_data_2(self): 71 colorizer = Colorizer("Paired", 5) 72 hues = colorizer.get_hues(data=range(3)) 73 sns_hues = sns.color_palette("Paired", 5)[:3] 74 self.assertListEqual(hues, sns_hues)