plorts package¶
Submodules¶
plorts.legend module¶
-
plorts.legend.label_line(line, x, label=None, **kwargs)¶
-
plorts.legend.legend(*args, **kwargs)¶ plt.legend with a few extra location options:
- inline: place legends on top of line
- end: place legend at the right end of line
- max: place legend slightly up and right of the max value of each line
Parameters: loc (string or int) – location to place the legend
-
plorts.legend.legend_end(xoff=0.05, yoff=0, *args, **kwargs)¶
-
plorts.legend.legend_inline(xvals=None, xoffset=None, **kwargs)¶
-
plorts.legend.legend_max(xoff=0.05, yoff=0.01, *args, **kwargs)¶
plorts.palettes module¶
Styles for plots.
Mainly adds the cool, warn, and neon themes from this post
-
plorts.palettes.colorblind= ['#0072B2', '#009E73', '#D55E00', '#CC79A7', '#F0E442', '#56B4E9']¶ colorblind-friendly colors for use in axes.prop_cycle
-
plorts.palettes.gradient_to_colormap(name, gradient)¶ Generates a matplotlib colormap from a gradient.
Plain white to black gradient
>>> plorts.palettes.gradient_to_colormap('bw', [(0, "white"), (1, "black")]) <matplotlib.colors.LinearSegmentedColormap object at ...>
First 25% of gradient is white to blue, second 75% is blue to black
>>> plorts.palettes.gradient_to_colormap('bw', [(0, "white"), (0.25, "#0000ff"), (1, "black")]) <matplotlib.colors.LinearSegmentedColormap object at ...>
Parameters: - name – name of the colormap to register with matplotlib
- gradient – list of tuples specifying gradient
Returns: Return type: matplotlib.colors.LinearSegmentedColormap
-
plorts.palettes.solarized= ['#6c71c4', '#268bd2', '#2aa198', '#859900', '#b58900', '#cb4b16', '#dc322f', '#d33682']¶ solarized colorsheme for axes.prop_cycle
plorts.plotting module¶
-
plorts.plotting.cdf(data, x, *args, **kwargs)¶ Plot a cdf from a dataframe column.
If hue is provided, plot many overlayed cdfs, one per value of the data[hue] column.
Parameters: - data (pandas.DataFrame) – dataframe to plot
- x (string) – column of data to plot
Keyword Arguments: hue (string) – column of dataframe to split on
-
plorts.plotting.colors_from_hue(data, hue, cmap)¶
-
plorts.plotting.hist(data, x, alpha=0.5, rwidth=0.92, *args, **kwargs)¶ Plot a histogram from a dataframe column.
If hue is provided, plot many overlayed histograms, one per value of the data[hue] column.
Parameters: - data (pandas.DataFrame) – dataframe to plot
- x (string) – column of data to plot
Keyword Arguments: - hue (string) – column of dataframe to split on
- alpha (float) – opacity of histogram (default: 0.5)
- rwidth (float) – The relative width of the bars as a fraction of the bin width (default: 0.92)
-
plorts.plotting.hueize(data, hue=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, *args, **kwargs)¶ Groups a dataframe by hues, if any, and generates plot settings for each hue.
Returns: Return type: Generator of (pd.DataFrame, kwargs), where the kwargs can be used in matplotlib functions.
Parameters: - data (pandas.DataFrame) – dataframe to plot
- x (string) – column of data to plot
Keyword Arguments: hue (string) – column of dataframe to split on
-
plorts.plotting.pdf(data, x, bins=10, normalize=True, *args, **kwargs)¶ Plot a probability density function (pdf) from a dataframe column.
If hue is provided, plot many overlayed pdf, one per value of the data[hue] column.
Parameters: - data (pandas.DataFrame) – dataframe to plot
- x (string) – column of data to plot
Keyword Arguments: - hue (string) – column of dataframe to split on
- bins (int or sequence of scalars or str, optional) – Bins to use for the function. See numpy.histogram <https://numpy.org/doc/stable/reference/generated/numpy.histogram.html>
- normalize (boolean) – Normalize to a probability density (default). If false, returns a histogram.
-
plorts.plotting.plot(data, x, y, error=None, *args, **kwargs)¶
-
plorts.plotting.savefig(filename, **kwargs)¶ Saves a figure, but also creates the directory and calls tight_layout before saving
-
plorts.plotting.scatter(data, x, y, markers=['o'], linestyles=[''], **kwargs)¶
-
plorts.plotting.stackplot(data, x, y, hue, cmap=<matplotlib.colors.LinearSegmentedColormap object>)¶
plorts.style module¶
-
plorts.style.style_axis(show_xaxis=False, label_fontweight='medium', label_fontstyle='italic', tight_layout=True)¶