discrimintools.fviz_dica_var#

discrimintools.fviz_dica_var(obj, axis=[0, 1], geom_var=('point', 'text'), repel=False, col_var='blue', point_args_var={'shape': 'o', 'size': 1.5}, text_args_var={'size': 8}, add_group=True, geom_group=('point', 'text'), point_args_group={'shape': '^', 'size': 3}, text_args_group={'size': 11.5}, palette=None, x_lim=None, y_lim=None, x_label=None, y_label=None, title=None, add_hline=True, add_vline=True, add_grid=True, ggtheme=None)[source]#

Visualize Discriminant Correspondence Analysis (DiCA) - Graph of variables/categories

Discriminant correspondence analysis (DiCA) is a canonical discriminant analysis on qualitative predictors. fviz_dica_var provides plotnine based elegant visualization of DiCA outputs for variables/categories.

Parameters:
  • obj (class) – An instance of class DiCA.

  • axis (list, defaul = [0,1]) – Dimensions to be plotted.

  • geom_var (str, list or tuple, default = (‘point’,’text’)) – Geometry to be used for the graph. Possible values are the combinaison of [“point”,”text”].

    • ‘point’ to show only points,

    • ‘text’ to show only labels,

    • (‘point’,’text’) to show both types.

  • repel (bool, default = False) – To avoid overplotting text labels.

  • col_var (str, default = ‘blue’) – Color for the variables points and texts.

  • point_args_var (dict, default = dict(shape = “o”, size = 1.5)) – Keywords arguments for geom_point.

  • text_args_var (dict, default = dict(size = 8)) – KeywordS arguments for geom_text.

  • add_group (bool, default = True) – To show group coordinates.

  • geom_group (str, list or tuple, default = (‘point’,’text’)) – See geom_ind.

  • point_args_group (dict, default = dict(shape = “^”, size = 3)) – See point_args_ind.

  • text_args_group (dict, default = dict(size = 11.5)) – See text_args_ind.

  • palette (None or list, default = None) – Color palette to be used for coloring by groups.

  • x_lim (None, list or tuple, default = None) – The range of the plotted x values.

  • y_lim (None, list or tuple, default = None) – The range of the plotted y values.

  • x_label (None or str, default = None) – The label text of x.

  • y_label (None or str, default = None) – The label text of y.

  • title (None or str, default = None) – The title of the graph you draw.

  • add_hline (bool, default = True) – To add a horizontal line.

  • add_vline (bool, default = True) – To add a vertical line.

  • add_grid (bool, default = True) – To add grid customization.

  • ggtheme (function, default = None) – Plotnine theme name.

Returns:

p – A object of class ggplot.

Return type:

class

See also

fviz_dica

Visualize Discriminant Correspondence Analysis (DiCA).

fviz_dica_biplot

Visualize Discriminant Correspondence Analysis (DiCA) - Biplot of individuals and variables.

fviz_dica_ind

Visualize Discriminant Correspondence Analysis (DiCA) - Graph of individuals.

fviz_dica_quali_var

Visualize Discriminant Correspondence Analysis (DiCA) - Graph of qualitative variables.

fviz_dist

Visualize distance between barycenter.

Examples

>>> from discrimintools.datasets import load_divay
>>> from discrimintools import DiCA, fviz_dica_var
>>> D = load_divay() # load training data
>>> y, X = D["Region"], D.drop(columns=["Region"]) # split into X and y
>>> clf = DiCA()
>>> clf.fit(X,y)
DiCA()
>>> p = fviz_dica_var(clf) # graph of variables
>>> print(p)
../../_static/fviz_dica_var.png

Fig. 15 Graph of variables - DiCA#