watex.view.QuickPlot.barcatdist#

QuickPlot.barcatdist(basic_plot=True, groupby=None, **kws)[source]#

Bar plot distribution.

Plots a categorical distribution according to the occurence of the target in the data.

Parameters
  • basic_pot (bool,) – Plot only the occurence of targetted columns from matplotlib.pyplot.bar function.

  • groupby (list or dict, optional) –

    Group features for plotting. For instance it plot others features located in the df columns. The plot features can be on list and use default plot properties. To customize plot provide, one may provide, the features on dict with convenients properties like:

    * `groupby`= ['shape', 'type'] #{'type':{'color':'b',
                                 'width':0.25 , 'sep': 0.}
                         'shape':{'color':'g', 'width':0.25,
                                 'sep':0.25}}
    

  • kws (dict,) – Additional keywords arguments from seaborn.countplot

  • 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.

Examples

>>> from watex.view.plot import QuickPlot
>>> from watex.datasets import load_bagoue
>>> data = load_bagoue ().frame
>>> qplotObj= QuickPlot(xlabel = 'Anomaly type',
                        ylabel='Number of  occurence (%)',
                        lc='b', tname='flow')
>>> qplotObj.sns_style = 'darkgrid'
>>> qplotObj.fit(data)
>>> qplotObj. barcatdist(basic_plot =False,
...                      groupby=['shape' ])