pistachioplots

Plotting utilities for exploratory data analysis and time series, built on
polars, plotnine and pistachiots.

The package installs as 'pistachioplots' and imports as 'PistachioPlots'.


INSTALLATION

    pip install pistachioplots


USAGE

    import PistachioPlots as pst

Every function returns a plotnine plot, or a dictionary of plots when it is
asked for several at once. Variables can be given explicitly or left out, in
which case the function picks the columns whose type fits.


DISTRIBUTIONS

    dist_density(df, var)       histogram with a kernel density overlay, and
                                optional analytic densities on top
    dist_density_cond(df, var, var_cat)
                                the same, conditioned on a categorical
                                variable, overlaid or in facets
    dist_mass(df, var)          bar chart of a categorical variable, with
                                percentage and count labels
    dist_mass_cond(df, var1, var2)
                                the distribution of var1 conditioned on var2,
                                in facets or as side-by-side bars


TIME SERIES

    ts(df, var, response)       one plot per variable, or a single faceted one
    ts_multiple(df, var)        several series in one panel or in facets
    ts_by_keys(df, var)         panel data with one or two keys
    time_breaks(plt, dates)     x-axis breaks and date format

These take a TSPolars object from pistachiots. 'response' gives one variable
the first color and the first place in the legend. 'ts_breaks_params' controls
the breaks: 'jump' (the step between them), 'date_format' and 'plot_minor'.


CORRELATIONS

    corrs(df, response)         Pearson, Spearman and Kendall coefficients
                                against a response, with significance marks
    corrs_matrix(df)            correlation matrix as a heatmap

Lagged variables named L1x, L2x and so on are grouped and sorted by lag number.


SCATTER AND LINES

    scatter(df, var)            scatter matrix across the given variables
    scatter(df, vary, varx)     a response against one or several covariates
    line(df, varx, vary)        a simple line, optionally stepped or filled


THEME AND COLORS

    theme_params_def            the default theme settings; copy it, change
                                what you need and pass it as theme_params
    colors_categ(series)        the palette for a categorical variable
    set_palette(colors)         override the package palette

    tms = pst.theme_params_def.copy()
    tms['x_angle'] = 90
    pst.dist_mass(df, 'region', theme_params = tms)


LICENSE

MIT. See the LICENSE.txt file.