watex.view.QuickPlot.corrmatrix#

QuickPlot.corrmatrix(cortype='num', features=None, method='pearson', min_periods=1, **sns_kws)[source]#

Method to quick plot the numerical and categorical features.

Set features by providing the names of features for visualization.

Parameters:
  • cortype (str,) – The typle of parameters to cisualize their coreletions. Can be num for numerical features and cat for categorical features. Default is num for quantitative values.

  • method (str,) – the correlation method. can be ‘spearman’ or person. *Default is pearson

  • features (List, optional) – list of the name of features for correlation analysis. If given, must be sure that the names belong to the dataframe columns, otherwise an error will occur. If features are valid, dataframe is shrunk to the number of features before the correlation plot.

  • min_periods – Minimum number of observations required per pair of columns to have a valid result. Currently only available for pearson and spearman correlation. For more details refer to https://www.geeksforgeeks.org/python-pandas-dataframe-corr/

  • sns_kws (Other seabon heatmap arguments. Refer to) – https://seaborn.pydata.org/generated/seaborn.heatmap.html

  • data (str or pd.core.DataFrame) – Path -like object or Dataframe. Long-form (tidy) dataset for plotting. Each column should correspond to a variable, and each row should correspond to an observation. If data is given as path-like object,`QuickPlot` reads and sanitizes data before plotting. Be aware in this case to provide the target name and possible the classes for data inspection. Both str or dataframe need to provide the name of target.

Returns:

Returns self for easy method chaining.

Return type:

QuickPlot instance

Notes

The argument for data must be passed to fit method. data parameter is not allowed in other QuickPlot method. The description of the parameter data is to give a synopsis of the kind of data the plot expected. An error will raise if force to pass data argument as a keyword arguments.

Example

>>> from watex.view.plot import QuickPlot
>>> from watex.datasets import load_bagoue
>>> data = load_bagoue ().frame
>>> qplotObj = QuickPlot().fit(data)
>>> sns_kwargs ={'annot': False,
...            'linewidth': .5,
...            'center':0 ,
...            # 'cmap':'jet_r',
...            'cbar':True}
>>> qplotObj.corrmatrix(cortype='cat', **sns_kwargs)