df_extensions/viz.py
def raincloud(
        self,
        values: str,
        groups: Optional[str] = None,
        one_value: Optional[str] = None,
        limit: Optional[List[str]] = None,
        ort: Optional[str] = "h",
        pal: Optional[str] = "Set2",
        sigma: Optional[float] = 0.2,
        title: Optional[str] = "",
        all_data_label: str = "All data",
        x_label: Optional[str] = None,
        y_label: Optional[str] = None,
    ):
        """
        helper function for visualising one column against
        another with raincloud plots.
        """

        df = self._obj

        if limit:
            df = df.loc[df[groups].isin(limit)]

        if groups is None:
            df[" "] = all_data_label
            groups = " "

        if one_value:
            df[groups] = (df[groups] == one_value).map(
                {False: "Other clusters", True: one_value}
            )

        f, ax = plt.subplots(figsize=(14, 2 * df[groups].nunique()))
        pt.RainCloud(
            x=df[groups],
            y=df[values],
            palette=pal,
            bw=sigma,
            width_viol=0.6,
            ax=ax,
            orient=ort,
            move=0.3,
        )
        if title:
            plt.title(title, loc="center", fontdict={"fontsize": 30})
        if x_label is not None:
            plt.xlabel(x_label, fontdict={"fontsize": 12})
        if y_label is not None:
            plt.ylabel(y_label, fontdict={"fontsize": 12}, rotation=0)
        plt.show()

        helper function for visualising one column against
        another with raincloud plots.
        
helper function for visualising one column against
another with raincloud plots.
helper function for visualising one column against another with raincloud plots .
def raincloud(
        self,
        values: str,
        groups: Optional[str] = None,
        one_value: Optional[str] = None,
        limit: Optional[List[str]] = None,
        ort: Optional[str] = "h",
        pal: Optional[str] = "Set2",
        sigma: Optional[float] = 0.2,
        title: Optional[str] = "",
        all_data_label: str = "All data",
        x_label: Optional[str] = None,
        y_label: Optional[str] = None,
    ):
        df = self._obj
        if limit:
            df = df.loc[df[groups].isin(limit)]
        if groups is None:
            df[" "] = all_data_label
            groups = " "
        if one_value:
            df[groups] = (df[groups] == one_value).map(
                {False: "Other clusters", True: one_value}
            )
        f, ax = plt.subplots(figsize=(14, 2 * df[groups].nunique()))
        pt.RainCloud(
            x=df[groups],
            y=df[values],
            palette=pal,
            bw=sigma,
            width_viol=0.6,
            ax=ax,
            orient=ort,
            move=0.3,
        )
        if title:
            plt.title(title, loc="center", fontdict={"fontsize": 30})
        if x_label is not None:
            plt.xlabel(x_label, fontdict={"fontsize": 12})
        if y_label is not None:
            plt.ylabel(y_label, fontdict={"fontsize": 12}, rotation=0)
        plt.show()
def raincloud ( self , values : str , groups : Optional [ str ] = None , one_value : Optional [ str ] = None , limit : Optional [ List [ str ] ] = None , ort : Optional [ str ] = "h" , pal : Optional [ str ] = "Set2" , sigma : Optional [ float ] = 0.2 , title : Optional [ str ] = "" , all_data_label : str = "All data" , x_label : Optional [ str ] = None , y_label : Optional [ str ] = None , ) : df = self . _obj if limit : df = df . loc [ df [ groups ] . isin ( limit ) ] if groups is None : df [ " " ] = all_data_label groups = " " if one_value : df [ groups ] = ( df [ groups ] == one_value ) . map ( { False : "Other clusters" , True : one_value } ) f , ax = plt . subplots ( figsize = ( 14 , 2 * df [ groups ] . nunique ( ) ) ) pt . RainCloud ( x = df [ groups ] , y = df [ values ] , palette = pal , bw = sigma , width_viol = 0.6 , ax = ax , orient = ort , move = 0.3 , ) if title : plt . title ( title , loc = "center" , fontdict = { "fontsize" : 30 } ) if x_label is not None : plt . xlabel ( x_label , fontdict = { "fontsize" : 12 } ) if y_label is not None : plt . ylabel ( y_label , fontdict = { "fontsize" : 12 } , rotation = 0 ) plt . show ( )
helper function for visualising one column against
another with raincloud plots.
helper function for visualising one column against another with raincloud plots .
"""
        helper function for visualising one column against
        another with raincloud plots.
        """
self
values
str
groups
Optional[str]
one_value
Optional[str]
limit
Optional[List[str]]
ort
Optional[str]
pal
Optional[str]
sigma
Optional[float]
title
Optional[str]
all_data_label
str
x_label
Optional[str]
y_label
Optional[str]