@@ -396,7 +396,7 @@ def associations(
396396 nan_strategy : str = _REPLACE ,
397397 nan_replace_value : Any = _DEFAULT_REPLACE_VALUE ,
398398 ax : Optional [plt .Axes ] = None ,
399- figsize : Optional [Tuple [int , int ]] = None ,
399+ figsize : Optional [Tuple [float , float ]] = None ,
400400 annot : bool = True ,
401401 fmt : str = ".2f" ,
402402 cmap : Optional [Colormap ] = None ,
@@ -439,16 +439,16 @@ def associations(
439439 '(con)' based on their type (nominal or continuous), as provided
440440 by nominal_columns
441441 nom_nom_assoc : callable / string, default = 'cramer'
442- If callable, a function which recieves two `pd.Series` and returns a single number.
442+ If callable, a function which receives two `pd.Series` and returns a single number.
443443 If string, name of nominal-nominal (categorical-categorical) association to use.
444444 Options are 'cramer' for Cramer's V or `theil` for Theil's U. If 'theil',
445445 heat-map columns are the provided information (U = U(row|col)).
446446 num_num_assoc : callable / string, default = 'pearson'
447- If callable, a function which recieves two `pd.Series` and returns a single number.
447+ If callable, a function which receives two `pd.Series` and returns a single number.
448448 If string, name of numerical-numerical association to use. Options are 'pearson'
449449 for Pearson's R, 'spearman' for Spearman's R, 'kendall' for Kendall's Tau.
450450 nom_num_assoc : callable / string, default = 'correlation_ratio'
451- If callable, a function which recieves two `pd.Series` and returns a single number.
451+ If callable, a function which receives two `pd.Series` and returns a single number.
452452 If string, name of nominal-numerical association to use. Options are 'correlation_ratio'
453453 for correlation ratio.
454454 symmetric_nom_nom : Boolean, default = True
@@ -458,19 +458,19 @@ def associations(
458458 Relevant only if `num_num_assoc` is a callable. Declare whether the function is symmetric (f(x,y) = f(y,x)).
459459 If False, heat-map values should be interpreted as f(row,col)
460460 display_rows : list / string, default = 'all'
461- Choose which of the dataset's features will be displyed in the output's
461+ Choose which of the dataset's features will be displayed in the output's
462462 correlations table rows. If string, can either be a single feature's name or 'all'.
463463 Only used if `hide_rows` is `None`.
464464 display_columns : list / string, default = 'all'
465- Choose which of the dataset's features will be displyed in the output's
465+ Choose which of the dataset's features will be displayed in the output's
466466 correlations table columns. If string, can either be a single feature's name or 'all'.
467467 Only used if `hide_columns` is `None`.
468468 hide_rows : list / string, default = None
469- Choose which of the dataset's features will not be displyed in the output's
469+ Choose which of the dataset's features will not be displayed in the output's
470470 correlations table rows. If string, must be a single feature's name. If `None`,
471471 `display_rows` is used.
472472 hide_columns : list / string, default = None
473- Choose which of the dataset's features will not be displyed in the output's
473+ Choose which of the dataset's features will not be displayed in the output's
474474 correlations table columns. If string, must be a single feature's name. If `None`,
475475 `display_columns` is used.
476476 cramers_v_bias_correction : Boolean, default = True
@@ -488,9 +488,9 @@ def associations(
488488 nan_strategy is set to 'replace'
489489 ax : matplotlib ax, default = None
490490 Matplotlib Axis on which the heat-map will be plotted
491- figsize : (int,int ) or None, default = None
492- A Matplotlib figure-size tuple. If `None`, falls back to Matplotlib's
493- default. Only used if `ax=None`.
491+ figsize : (float, float ) or None, default = None
492+ A Matplotlib figure-size tuple. If `None`, will attempt to set the size automatically.
493+ Only used if `ax=None`.
494494 annot : Boolean, default = True
495495 Plot number annotations on the heat-map
496496 fmt : string, default = '.2f'
@@ -564,7 +564,7 @@ def associations(
564564 pass # will be handled pair-by-pair during calculations
565565 else :
566566 raise ValueError (
567- "Argument nan_stragety [{:s}] is not a valid choice." .format (
567+ "Argument nan_strategy [{:s}] is not a valid choice." .format (
568568 nan_strategy
569569 )
570570 )
@@ -614,6 +614,12 @@ def associations(
614614 )
615615 displayed_features_set = set .union (set (display_rows ), set (display_columns ))
616616
617+ # Adjusting figsize based on the number of features
618+ if figsize is None :
619+ BASE_SIZE = 1.5 # Size multiplier per feature
620+ num_features = len (displayed_features_set )
621+ figsize = (BASE_SIZE * num_features , BASE_SIZE * num_features )
622+
617623 # convert timestamp columns to numerical columns, so correlation can be performed
618624 datetime_dtypes = [
619625 str (x ) for x in df .dtypes if str (x ).startswith ("datetime64" )
0 commit comments