Skip to content

Funnel Charts

Big Number

Coming soon!

Wordcloud

src.dx.plotting.dex.basic_charts.wordcloud(df, word_column, size, text_format='sentence', word_rotation=None, random_coloring=False, return_view=False, **kwargs)

Generates a DEX wordcloud from the given DataFrame.

Parameters:

Name Type Description Default
df DataFrame

The DataFrame to plot.

required
word_column str

The column to use for the words in the cloud.

required
size str

The column to use for the size of the words in the cloud.

required
text_format DEXTextDataFormat

The format of the text data. Either "sentence" or "token".

'sentence'
word_rotation Optional[DEXWordRotate]

The rotation to use for the words in the cloud (45, 90, "jitter", or None).

None
random_coloring bool

Whether to use random coloring for the words in the cloud.

False
return_view bool

Whether to return a DEXView object instead of render.

False
**kwargs

Additional keyword arguments to pass to the view metadata.

{}
Source code in src/dx/plotting/dex/basic_charts.py
def wordcloud(
    df: pd.DataFrame,
    word_column: str,
    size: str,
    text_format: options.DEXTextDataFormat = "sentence",
    word_rotation: Optional[options.DEXWordRotate] = None,
    random_coloring: bool = False,
    return_view: bool = False,
    **kwargs,
) -> Optional[DEXWordcloudChartView]:
    """
    Generates a DEX wordcloud from the given DataFrame.

    Parameters
    ----------
    df: pd.DataFrame
        The DataFrame to plot.
    word_column: str
        The column to use for the words in the cloud.
    size: str
        The column to use for the size of the words in the cloud.
    text_format: DEXTextDataFormat
        The format of the text data. Either `"sentence"` or `"token"`.
    word_rotation: Optional[DEXWordRotate]
        The rotation to use for the words in the cloud (`45`, `90`, `"jitter"`, or `None`).
    random_coloring: bool
        Whether to use random coloring for the words in the cloud.
    return_view: bool
        Whether to return a `DEXView` object instead of render.
    **kwargs
        Additional keyword arguments to pass to the view metadata.
    """
    raise_for_missing_columns([word_column, size], df.columns)

    chart_settings = {
        "text_data_format": text_format,
        "token_metric": size,
        "word_data": word_column,
        "word_color": "random" if random_coloring else "none",
        "word_rotate": word_rotation if word_rotation else "none",
    }
    return handle_view(
        df,
        chart_mode="wordcloud",
        chart=chart_settings,
        return_view=return_view,
        **kwargs,
    )

Dimension Matrix

Coming soon!

Violin

src.dx.plotting.dex.summary_charts.violin(df, split_by, metric, bins=30, show_interquartile_range=False, column_sort_order='asc', column_sort_type='string', return_view=False, **kwargs)

Generates a DEX violin plot from the given DataFrame.

Parameters:

Name Type Description Default
df DataFrame

The DataFrame to plot.

required
split_by str

The column to use for splitting the data.

required
metric str

The column to use to show distribution and density.

required
bins int

The number of bins to use for the violin plot.

30
show_interquartile_range bool

Whether to show the interquartile range.

False
column_sort_order DEXSortColumnsByOrder

The order to sort the columns by. ("asc" or "desc")

'asc'
column_sort_type DEXSortColumnsByType

The type of sorting to use. ("number", "string", or "date")

'string'
return_view bool

Whether to return a DEXView object instead of render.

False
**kwargs

Additional keyword arguments to pass to the view metadata.

{}
Source code in src/dx/plotting/dex/summary_charts.py
def violin(
    df: pd.DataFrame,
    split_by: str,
    metric: str,
    bins: int = 30,
    show_interquartile_range: bool = False,
    column_sort_order: options.DEXSortColumnsByOrder = "asc",
    column_sort_type: options.DEXSortColumnsByType = "string",
    return_view: bool = False,
    **kwargs,
) -> Optional[DEXViolinChartView]:
    """
    Generates a DEX violin plot from the given DataFrame.

    Parameters
    ----------
    df: pd.DataFrame
        The DataFrame to plot.
    split_by: str
        The column to use for splitting the data.
    metric: str
        The column to use to show distribution and density.
    bins: int
        The number of bins to use for the violin plot.
    show_interquartile_range: bool
        Whether to show the interquartile range.
    column_sort_order: DEXSortColumnsByOrder
        The order to sort the columns by. (`"asc"` or `"desc"`)
    column_sort_type: DEXSortColumnsByType
        The type of sorting to use. (`"number"`, `"string"`, or `"date"`)
    return_view: bool
        Whether to return a `DEXView` object instead of render.
    **kwargs
        Additional keyword arguments to pass to the view metadata.
    """
    if str(column_sort_order).lower() == "asc":
        sort_order = "desc"
    elif str(column_sort_order).lower() == "desc":
        sort_order = "asc"
    chart_params = dict(
        summary_bins=bins,
        sort_columns_by=f"{sort_order}-col-{column_sort_type}",
        violin_iqr=show_interquartile_range,
    )
    return summary(
        df,
        split_by=split_by,
        metric=metric,
        summary_type="violin",
        chart_params=chart_params,
        return_view=return_view,
        **kwargs,
    )

Boxplot

Coming soon!

Heatmap

Coming soon!

Histogram

Coming soon!

Ridgeline

Coming soon!

Horizon

Coming soon!

Hexbin

Coming soon!