API¶
Base functionality for three different types of charts.
Includes plot (for line chart and scatter), hist, and bar.
-
plit.core.
bar
(x, y, labels, xlab, ylab, ax=None, ylim=None, grid=False, href=None, title=None, subtitle=None, overlap=False, colors=None, horizontal=False, figsize=(10, 7), pct_ticks=False, figname=None, **kwargs)¶ Create a bar plot for up to 5 series/groups.
- Parameters
(list (colors) – string): list of group labels for x axis.
(list[ (y) – list]:float): list or list of lists of data points y-coordinates.
(list – str): labels for each series to be displayed on legend.
xlab (string) – label for x-axis
ylab (string) – label for y-axis
ax (Axes, optional) – A matplotlib Axes object.
(list – float, optional): optional limiter for y-axis.
grid (bool, optional) – whether you would like a bacground grid. Defaults to false.
href (float, optional) – whether you would like a horizontal ref. line.
title (string, optional) – chart title
subtitle (string, optional) – chart subtitle.
overlap (bool, optional) – Come back.
(list – str, optional): Colors for the bars if desired to overwrite defaults.
horizontal (bool, optional) – Select horizontal bars.
(tuple (figsize) – int, optional): figure size. Ignored if Axes object provided.
pct_ticks (bool, optional) – Whether you want percent ticks.
figname (string, optional) – figure name if you would like a saved image.
**kwargs – Arbitrary keyword arguments.
- Returns
- for more detail see matplotlib docs:
https://matplotlib.org/3.1.1/api/index.html#the-object-oriented-api
- Return type
Axes object
-
plit.core.
hist
(x, labels, xlab, ax=None, grid=False, alpha=0.7, edgecolor='0.1', ylab='Count', colors=None, title=None, subtitle=None, figsize=(10, 7), figname=None, **kwargs)¶ Create a histogram.
- Parameters
(list (colors) – arrays): list of data arrays to create bins and counts for.
(list – str): labels for each series to be displayed on legend.
xlab (str) – Descriptive x label.
ax (Axes, optional) – A matplotlib Axes object.
grid (bool, optional) – whether you would like a bacground grid.
title (str) – Descriptive title for the chart.
subtitle (string, optional) – chart subtitle
alpha (float, optional) – transparency.
edgecolor (string, optional) – color for edges.
ylab (str, optional) – Y axis value.
(list – str, optional): Colors for the bars if desired to overwrite defaults.
(int or list (bins) – float, optional): the number or actual bins to count data in. Default to 10.
**kwargs – Arbitrary keyword arguments.
- Returns
- for more detail see matplotlib docs:
https://matplotlib.org/3.1.1/api/index.html#the-object-oriented-api
- Return type
Axes object
-
plit.core.
plot
(x, y, labels, xlab, ylab, ax=None, xlim=None, ylim=None, href=None, vref=None, title=None, subtitle=None, xticks=None, set_xticks=False, pct_ticks=(False, False), marker_type='-', markers=None, figname=None, grid=False, figsize=(10, 7), **kwargs)¶ Create a line chart or scatter forseries/groups.
- Parameters
(list[ (y) – list]:string): list or list of lists of data points x-coordinates.
(list[ – list]:float): list or list of lists of data points y-coordinates.
(list (markers) – str): labels for each series to be displayed on legend.
xlab (string) – label for x-axis
ylab (string) – label for y-axis
ax (Axes, optional) – A matplotlib Axes object.
(list – float, optional): optional limiter for x-axis
(list – float, optional): optional limiter for y-axis
href (float, optional) – horizontal ref. line.
vref (float, optional) – vertical ref. line.
title (string, optional) – chart title
subtitle (string, optional) – chart subtitle
(list – float, optional): xticks to be used if not x.
set_xticks (bool, optional) – Whether xticks should be set based off of the x data. Only useful when there are few unique data points (e.g., 10).
(tuple (figsize) – bool, optional): Whether you want percent ticks for (x,y)
marker_type (string, optional) – Common options: ‘-‘ (line), ‘–’ (dashed line), ‘o’ (scatter), and ‘o-‘ (line with dots). See matplotlib docs for complete list. https://matplotlib.org/3.1.1/api/markers_api.html Will be ignored if series-specific markers are provided.
(list – string, optional): Marker types using the standard shorthand. Useful when compariing multiple types of objects. For example, compariing models and hypers in the same chart. Colors and shapes can be combined (e.g. ‘k-‘ for black lines)
figname (string, optional) – figure name if you would like a saved image
grid (bool, optional) – whether you would like a bacground grid.
(tuple – int, optional): figure size. Ignored if Axes object provided.
**kwargs – Arbitrary keyword arguments.
- Returns
- for more detail see matplotlib docs:
https://matplotlib.org/3.1.1/api/index.html#the-object-oriented-api
- Return type
Axes object
-
plit.core.
subplots
(ncols=1, nrows=1, figsize=(8, 8), **kwargs)¶ For creating subplots.
- Parameters
ncols (int, optional) – Number of columns.
nrows (int, optional) – Number of rows.
(tuple (figsize) – int, optional): size for entire chart. Counterintuitively, but in keeping with matplotlib convention, specified as (width, height).
- Returns
A tuple consisting of a matplotlib figure and a matplotlib Axes array.