bff.plot.plot_correlation

bff.plot.plot_correlation(df, already_computed=False, method='pearson', title='Correlation between variables', ax=None, rotation_xticks=90, rotation_yticks=None, figsize=13, 10, dpi=80, style='white', **kwargs)

Plot the correlation between variables of a pandas DataFrame.

The computing of the correlation can be done either in the function or before.

Parameters
  • df (pd.DataFrame) – DataFrame with the values or the correlations.

  • already_computed (bool, default False) – Set to True if the DataFrame already contains the correlations.

  • method (str, default 'pearson') – Type of normalization. See pandas.DataFrame.corr for possible values.

  • title (str, default 'Correlation between variables') – Title for the plot (axis level).

  • ax (plt.axes, optional) – Axes from matplotlib, if None, new figure and axes will be created.

  • rotation_xticks (float or None, default 90) – Rotation of x ticks if any.

  • rotation_yticks (float, optional) – Rotation of x ticks if any. Set to 90 to put them vertically.

  • figsize (Tuple[int, int], default (13, 10)) – Size of the figure to plot.

  • dpi (int, default 80) – Resolution of the figure.

  • style (str, default 'white') – Style to use for seaborn.axes_style. The style is use only in this context and not applied globally.

  • **kwargs – Additional keyword arguments to be passed to the sns.heatmap function from seaborn.

Returns

Axes returned by the plt.subplots function.

Return type

plt.axes