Modules¶
fcp.py¶
- 
fivecentplots.fcp.axes()¶
- ax_edge_color (hex color string): outer edge color of plot area;
- default: #aaaaaa; ex: None
- ax_fill_color (hex color string): inner fill color of plot area |
- x-axis: [‘linear’, ‘logx’, ‘semilogx’] | y-axis: [‘linear’, ‘logx’, ‘semilogx’] | both: [‘loglog’, ‘log’] | other: [‘symlog’, ‘logit’]; default: #eaeaea; ex: None
- ax_size (list of ints): width, height of plot area; default: [400,
- 400]; ex: None
- twin_x (boolean): enable/disable a secondary y-axis (x-axis is
- “twinned” or duplicated across two y-axes); default: False; ex: see online docs
- twin_y (boolean): enable/disable a secondary x-axis (y-axis is
- “twinned” or duplicated across two x-axes) | Note: wrap plots cannot be used when twin_y == True; default: False; ex: see online docs
- xmin (float|list of floats|None): minimum x-values; can use a list for
- each subplot; default: None; ex: see online docs
- x2min (float|list of floats|None): minimum x-values; can use a list
- for each subplot; default: None; ex: see online docs
- xmax (float|list of floats|None): maximum x-values; can use a list for
- each subplot; default: None; ex: see online docs
- x2max (float|list of floats|None): maximum x-values for secondary
- axis; can use a list for each subplot; default: None; ex: see online docs
- ymin (float|list of floats|None): minimum y-values; can use a list for
- each subplot; default: None; ex: see online docs
- y2min (float|list of floats|None): minimum y-values for secondary
- axis; can use a list for each subplot; default: None; ex: see online docs
- ymax (float|list of floats|None): maximum y-values; can use a list for
- each subplot; default: None; ex: see online docs
- y2max (float|list of floats|None): maximum y-values for secondary
- axis; can use a list for each subplot; default: None; ex: see online docs
 
- 
fivecentplots.fcp.bar(*args, **kwargs)¶
- Main bar chart plotting function At minimum, it requires a pandas DataFrame with at least one column for the y axis. Plots can be customized and enhanced by passing keyword arguments. Default values that must be defined in order to generate the plot are pulled from the fcp_params default dictionary :param df: DataFrame containing data to plot :type df: DataFrame :param x: name of x column in df :type x: str :param y: name or list of names of y column(s) in df :type y: str|list - Keyword Arguments: - online docs (see) – - Returns: - plots 
- 
fivecentplots.fcp.boxplot(*args, **kwargs)¶
- Main boxplot plotting function At minimum, it requires a pandas DataFrame with at least one column for the y axis. Plots can be customized and enhanced by passing keyword arguments. Default values that must be defined in order to generate the plot are pulled from the fcp_params default dictionary - Parameters: - df (DataFrame) – DataFrame containing data to plot
- y (str|list) – column name in df to use for the box(es)
 - Keyword Arguments: - Dividers (Box) – - box_divider_on (boolean): toggle divider lines between groups on/off;
- default: True; ex: None
 box_divider_color (str): line color; default: #bbbbbb; ex: None 
- Range Lines (Box) – - box_range_lines_on (boolean): toggle range lines on/off; default:
- True; ex: None
 box_range_lines_color (str): line color; default: #cccccc; ex: None box_range_lines_style (str): horizontal lines at the end of the range; default: -; ex: None- box_range_lines_style2 (str): vertical lines connecting the horizontal
- lines at the end of the range; default: –; ex: None
 
- Stat Lines (Box) – - box_stat_line_on (boolean): toggle divider lines between groups
- on/off; default: True; ex: None
- box_stat_line (str): set the statistic for the connecting line;
- default: mean; ex: None
 box_stat_line_color (str): line color; default: #666666; ex: None 
 
- 
fivecentplots.fcp.cbar()¶
- cbar (boolean): toggle colorbar on/off for contour and heatmap plots;
- default: False; ex: see online docs
- size (int): cbar width (height will match the height of the axes);
- default: 30; ex: nan
 
- 
fivecentplots.fcp.contour(*args, **kwargs)¶
- Main contour plotting function At minimum, it requires a pandas DataFrame with at least three columns and three column names for the x, y, and z axis. Plots can be customized and enhanced by passing keyword arguments as defined below. Default values that must be defined in order to generate the plot are pulled from the fcp_params default dictionary - Parameters: - df (DataFrame) – DataFrame containing data to plot
- x (str|list) – name of list of names of x column in df
- y (str|list) – name or list of names of y column(s) in df
- z (str) – name of z column(s) in df
 - Keyword Arguments: - bar (Color) – - cbar (boolean): toggle colorbar on/off for contour and heatmap plots;
- default: False; ex: see online docs 
- size (int): cbar width (height will match the height of the axes);
- default: 30; ex: nan 
 
- 
fivecentplots.fcp.deprecated(kwargs)¶
- Fix deprecated keyword args 
- 
fivecentplots.fcp.figure()¶
- dpi (int): dots per inch; default: 100; ex: None 
- 
fivecentplots.fcp.fit()¶
- fit (int): polynomial degree for the fit; default: None; ex: see
- online docs
- fit_color (hex color str): color of the fit line; default: #000000;
- ex: None
- fit_eqn (boolean): display the fit equation on the plot; default:
- False; ex: None
- fit_font_size (float): font size of the fit eqn and rsq value;
- default: 12; ex: None
- fit_padding (int): padding in pixels from the top of the plot to the
- location of the fit eqn; default: 10; ex: None
- fit_range_x (list): compute the fit only over a given range of
- x-values; default: None; ex: see online docs
- fit_range_y (list): compute the fit only over a given range of
- y-values; default: None; ex: nan
- fit_rsq (boolean): display the rsq of the fit on the plot; default:
- False; ex: None
 
- 
fivecentplots.fcp.gridlines()¶
- 
fivecentplots.fcp.heatmap(*args, **kwargs)¶
- Main heatmap plotting function At minimum, it requires a pandas DataFrame with at least three columns and three column names for the x, y, and z axis. Plots can be customized and enhanced by passing keyword arguments as defined below. Default values that must be defined in order to generate the plot are pulled from the fcp_params default dictionary - Parameters: - df (DataFrame) – DataFrame containing data to plot
- x (str|list) – name of list of names of x column in df
- y (str|list) – name or list of names of y column(s) in df
- z (str) – name of z column(s) in df
 - Keyword Arguments: - bar (Color) – - cbar (boolean): toggle colorbar on/off for contour and heatmap plots;
- default: False; ex: see online docs 
- size (int): cbar width (height will match the height of the axes);
- default: 30; ex: nan 
 
- 
fivecentplots.fcp.help()¶
- 
fivecentplots.fcp.hist(*args, **kwargs)¶
- Histogram plot 
- 
fivecentplots.fcp.kw_header(val, indent=' ')¶
- Indent header names 
- 
fivecentplots.fcp.kw_print(kw)¶
- Print friendly version of kw dicts 
- 
fivecentplots.fcp.labels()¶
- 
fivecentplots.fcp.legend()¶
- legend (str): name of a DataFrame column to use for grouping; default:
- None; ex: see online docs
- location (int | str): location of legend (at this time only outside of
- the plot is available!): | * 0 | “outside” = outside of plot on right side | * 1 | “upper right” = upper right inside corner | * 2 | “upper left = upper left inside corner | * 3 | “lower left” = lower left inside corner | * 4 | “lower right” = lower right inside corner | * 5 | “right” | * 6 | “center left” | * 7 | “center right” | * 8 | “lower center” | * 9 | “upper center” | * 10 | “center” ; default: 0; ex: None
- legend_marker_alpha (float): alpha of the markers in the legend only;
- default: 1; ex: see online docs
- legend_marker_size (float): marker size in legend only; default: same
- as marker_size; ex: see online docs
- legend_points (int): number of points for each legend value; default:
- 1; ex: None
- legend_title (str): legend title text; default: defaults to legend
- column name; ex: None
 
- 
fivecentplots.fcp.lines()¶
- colors (hex color str or list of hex color strs): colors to use for
- lines and markers; default: default list; ex: see online docs
 - lines (boolean): toggle line visibility; default: True; ex: None 
- 
fivecentplots.fcp.markers()¶
- markers (boolean or list of str characters): if False, turns off
- markers on the plot | if a list of characters, sets the markers to be used (one marker type per curve or data set); default: default marker list; ex: see online docs
- marker_fill (boolean): turn on/off marker fill; default: False; ex:
- None
- marker_edge_color (hex color str): set the marker edge color; default:
- match the line color scheme; ex: None
- marker_edge_width (float): set the marker edge width; default: 1.5;
- ex: None
- marker_fill_color (hex color str): set the marker fill color (only
- rendered if marker_fill=True); default: True; ex: None
- marker_jitter (boolean): add a random offset or jitter to the points
- around their x-value (useful for box plots); default: True for boxplots | False for all other plot types; ex: None
- marker_size (float): size of the markers (can be specified uniquely
- from the legend marker size); default: 7; ex: see online docs
 
- 
fivecentplots.fcp.nq(*args, **kwargs)¶
- Plot normal quantiles of a data set 
- 
fivecentplots.fcp.paste_kwargs(kwargs)¶
- Get the kwargs from contents of the clipboard in ini file format - Parameters: - kwargs (dict) – originally inputted kwargs - Returns: - kwargs 
- 
fivecentplots.fcp.plot(*args, **kwargs)¶
- XY plot 
- 
fivecentplots.fcp.plot_bar(data, layout, ir, ic, df_rc, kwargs)¶
- Plot data as boxplot - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plot_box(dd, layout, ir, ic, df_rc, kwargs)¶
- Plot data as boxplot - Parameters: - dd (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 - Keywords: 
- 
fivecentplots.fcp.plot_conf_int(ir, ic, iline, data, layout, df, x, y, twin)¶
- 
fivecentplots.fcp.plot_contour(data, layout, ir, ic, df_rc, kwargs)¶
- Plot contour data - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plot_fit(data, layout, ir, ic, iline, df, x, y, twin, leg_name, ngroups)¶
- Plot a fit line - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- iline (int) – iterator
- df (pd.DataFrame) – input data
- x (str) – x-column name
- y (str) – y-column name
- twin (bool) – denote twin axis
- leg_name (str) – legend value
- ngroups (int) – number of groups in this data set
 
- 
fivecentplots.fcp.plot_heatmap(data, layout, ir, ic, df_rc, kwargs)¶
- Plot heatmap data data - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plot_hist(data, layout, ir, ic, df_rc, kwargs)¶
- Plot data as histogram - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plot_nq(data, layout, ir, ic, df_rc, kwargs)¶
- Plot data as normal quantiles by sigma - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plot_ref(ir, ic, iline, data, layout, df, x, y)¶
- Plot a reference line 
- 
fivecentplots.fcp.plot_stat(ir, ic, iline, data, layout, df, x, y, leg_name=None, twin=False)¶
- Plot a line calculated by stats 
- 
fivecentplots.fcp.plot_xy(data, layout, ir, ic, df_rc, kwargs)¶
- Plot xy data - Parameters: - data (obj) – Data object
- layout (obj) – layout object
- ir (int) – current subplot row number
- ic (int) – current subplot column number
- df_rc (pd.DataFrame) – data subset
- kwargs (dict) – keyword args
 
- 
fivecentplots.fcp.plotter(plot_func, **kwargs)¶
- Main plotting function - UPDATE At minimum, it requires a pandas DataFrame with at least two columns and two column names for the x and y axis. Plots can be customized and enhanced by passing keyword arguments as defined below. Default values that must be defined in order to generate the plot are pulled from the fcp_params default dictionary - Parameters: - df (DataFrame) – DataFrame containing data to plot
- x (str) – name of x column in df
- y (str|list) – name or list of names of y column(s) in df
 - Keyword Arguments: - UPDATE – - Returns: - plots 
- 
fivecentplots.fcp.ref_line()¶
- color (hex color str): color of the reference line; default: #000000;
- ex: see online docs
- text (str): legend text for the reference line; default: “Ref Line”;
- ex: nan
 
- 
fivecentplots.fcp.set_theme(theme=None)¶
- Select a “defaults” file and copy to the user directory 
- 
fivecentplots.fcp.tick_labels()¶
- 
fivecentplots.fcp.ticks()¶
- ticks_<major|minor>_color (hex color string): tick color; default:
- #ffffff; ex: None
- ticks_major_increment (float): for major ticks only, the increment
- between tick marks; default: nan; ex: see online docs
- ticks_major_length (float): the length in pixels of the major tick
- lines; default: 6.2; ex: None
- ticks_minor_length (float): the length in pixels of the minor tick
- lines; default: 4.2; ex: None
- tick_minor_number (int): enable primary y-axis range sharing across
- all subplots; default: True; ex: see online docs
- ticks_major_width (float): thickness or edge width of a major tick
- mark; default: 2.2; ex: None
- ticks_minor_width (float): thickness or edge width of a minor tick
- mark; default: 1.3; ex: None
 
- 
fivecentplots.fcp.ws()¶
- ws_label_col (int): col label to top edge of axes window; default: 10;
- ex: None
- ws_label_row (nan): row label to right edge of axes window; default:
- 10; ex: None
 - ws_col (nan): space between columns; default: 30; ex: None ws_row (nan): space between rows; default: 30; ex: None ws_fig_label (nan): left figure edge to label_y; default: 10; ex: None ws_leg_fig (nan): right legend edge to right figure edge; default: 10; ex: None- ws_fig_ax (nan): top figure edge to top edge of axes with figure title
- disabled; default: 20; ex: None
- ws_fig_title (nan): top figure edge to top of figure title; default:
- 10; ex: None
- ws_label_tick (nan): space between axis label and tick labels;
- default: 10; ex: None
- ws_leg_ax (nan): right edge of axes to left edge of legend box;
- default: 20; ex: None
- ws_ticks_ax (nan): space between tick labels and axes; default: 5; ex:
- None
- ws_title_ax (nan): bottom edge of title to top edge of axes window;
- default: 10; ex: None
- ws_ax_fig (nan): right edge of axes to right edge of figure with
- legend disabled; default: 30; ex: None
- ws_tick_tick_minimum (nan): minimum space between consecutive ticks;
- default: 10; ex: None
- ws_ax_box_title (nan): right edge of axes to right edge of box title
- text ; default: 10; ex: None
 
data.py¶
- 
exception fivecentplots.data.AxisError(*args, **kwargs)¶
- 
class fivecentplots.data.Data(plot_func='xy', **kwargs)¶
- 
ax_limit_pad(**kwargs)¶
- Set padding limits for axis 
 - 
check_df(df)¶
- Validate the dataframe 
 - 
check_group_columns(group_type, col_names)¶
- Check wrap/row/column grouping variables for errors - Parameters: - group_type (str) – type of grouping (row, col, leg, wrap)
- col_name (str) – name of the column by which to group
 
 - 
check_group_errors()¶
- Check for common errors related to grouping keywords 
 - 
check_group_matching(group1, group2)¶
- Check to make sure certain group column values are not the same - Parameters: - group1 (str) – attr name of first grouping column
- group2 (str) – attr name of second grouping column
 
 - 
check_xyz(xyz)¶
- Validate the name and column data provided for x, y, and/or z :param xyz: name of variable to check :type xyz: str 
 - 
get_all_groups(df)¶
- Generator to get all possible allowed groups of data - Parameters: - df – - Returns: 
 - 
get_box_index_changes()¶
- Make a DataFrame that shows when groups vals change; used for grouping labels - Parameters: - df (pd.DataFrame) – grouping values
- num_groups (int) – number of unique groups
 - Returns: - new DataFrame with 1’s showing where group levels change for each row of df 
 - 
get_conf_int(df, x, y, **kwargs)¶
- Calculate and draw confidence intervals around a curve - Parameters: - df –
- x –
- y –
- ax –
- color –
- kw –
 - Returns: 
 - 
get_data_range(ax, df, ir, ic)¶
- Determine the min/max values for a given axis based on user inputs - Parameters: - axis (str) – x, x2, y, y2, z
- df (pd.DataFrame) – data table to use for range calculation
 - Returns: - min, max tuple 
 - 
get_data_ranges(ir, ic)¶
- Get the data ranges - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
get_data_ranges_bar(ir, ic)¶
- Get the data ranges for bar plot data - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
get_data_ranges_hist(ir, ic)¶
- Get the data ranges - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
get_df_figure()¶
- Generator to subset the main DataFrame based on fig_item grouping - Parameters: - fig_item (str) – figure grouping value
- kw (dict) – kwargs dict
 - Returns: - DataFrame subset 
 - 
get_fig_groupings()¶
- Determine the figure grouping levels 
 - 
get_fit_data(ir, ic, df, x, y)¶
- Make columns of fitted data - Parameters: - df (pd.DataFrame) – main DataFrame
- x (str) – x-column name
- y (str) – y-column name
 - Returns: - updated DataFrame and rsq (for poly fit only) 
 - 
get_legend_groupings(df)¶
- Determine the legend groupings - Parameters: - df (pd.DataFrame) – data being plotted - Returns: - updated kwargs dict 
 - 
get_plot_data(df)¶
- Generator to subset into discrete sets of data for each curve - Parameters: - df (pd.DataFrame) – main DataFrame - Returns: - subset 
 - 
get_rc_groupings(df)¶
- Determine the row and column or wrap grid groupings - Parameters: - df (pd.DataFrame) – data being plotted; usually a subset of self.df_all 
 - 
get_rc_subset(df, ranges=False)¶
- Subset the data by the row/col values - Parameters: - df (pd.DataFrame) – main DataFrame - Returns: - subset DataFrame 
 - 
get_stat_data(df, x, y)¶
- Get a stat subset from input data - Parameters: - df (pd.DataFrame) – input data
- x (str) – x-column name
- y (str) – y-column name
 
 - 
groupers¶
- Get all grouping values 
 - 
see()¶
- Prints a readable list of class attributes 
 - 
swap_xy()¶
- Swap the x and y axis 
 - 
transform()¶
- Transform x, y, or z data by unique group 
 
- 
- 
exception fivecentplots.data.DataError(*args, **kwargs)¶
- 
exception fivecentplots.data.GroupingError(*args, **kwargs)¶
layout.py¶
- 
class fivecentplots.engines.layout.BaseLayout(plot_func, data, **kwargs)¶
- 
add_box_labels(ir, ic, dd)¶
 - 
add_hvlines(ir, ic)¶
 - 
add_legend()¶
 - 
close()¶
 - 
format_legend_values()¶
- Reformat legend values 
 - 
from_list(base, attrs, name, kwargs)¶
- Supports definition of object attributes for multiple axes using a list - Index 0 is always ‘x’ Index 1 is always ‘y’ Index 2 is for twinned axes - Parameters: - base (Element) – object class
- attrs (list) – attributes to check from the base class
- name (str) – name of the base class
- kwargs (dict) – keyword dict
 - Returns: - updated kwargs 
 - 
get_axes()¶
- Return list of active axes 
 - 
init_white_space(**kwargs)¶
- Set the default spacing parameters (plot engine specific) :param kwargs: input args from user 
 - 
make_figure()¶
 - 
make_kwargs(element, pop=[])¶
 - 
plot_box(ir, ic, data, **kwargs)¶
- Plot boxplot data - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- data (pd.DataFrame) – data to plot
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the box plot object 
 - 
plot_contour(ax, df, x, y, z, ranges)¶
- Plot a contour plot 
 - 
plot_heatmap(ax, df, x, y, z, ranges)¶
- Plot a heatmap - Parameters: - ax (mpl.axes) – current axes obj
- df (pd.DataFrame) – data to plot
- x (str) – x-column name
- y (str) – y-column name
- z (str) – z-column name
- range (dict) – ax limits
 
 - 
plot_hist(ir, ic, iline, df, x, y, leg_name, data, zorder=1, line_type=None, marker_disable=False)¶
 - 
plot_line(ir, ic, x0, y0, x1=None, y1=None, **kwargs)¶
- Plot a simple line - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- x0 (float) – min x coordinate of line
- x1 (float) – max x coordinate of line
- y0 (float) – min y coordinate of line
- y1 (float) – max y coordinate of line
- kwargs – keyword args
 
 - 
plot_xy(ir, ic, iline, df, x, y, leg_name, twin, zorder=1, line_type=None, marker_disable=False)¶
- Plot xy data - Parameters: - x (np.array) – x data to plot
- y (np.array) – y data to plot
- color (str) – hex color code for line color (default=’#000000’)
- marker (str) – marker char string (default=’o’)
- points (bool) – toggle points on|off (default=False)
- line (bool) – toggle plot lines on|off (default=True)
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the line plot object 
 - 
save(filename)¶
 - 
see()¶
- Prints a readable list of class attributes 
 - 
set_axes_colors(ir, ic)¶
 - 
set_axes_grid_lines(ir, ic)¶
 - 
set_axes_labels(ir, ic)¶
 - 
set_axes_ranges(ir, ic)¶
 - 
set_axes_rc_labels(ir, ic)¶
 - 
set_axes_scale(ir, ic)¶
 - 
set_axes_ticks(ir, ic)¶
 - 
set_figure_title()¶
 - 
set_label_text(data, **kwargs)¶
- Set the default label text - Parameters: - data (Data object) – current Data object 
 - 
show(inline=True)¶
 - 
update_from_data(data)¶
- Make properties updates from the Data class 
 - 
update_wrap(data, kwargs)¶
- Update figure props based on wrap selections 
 
- 
- 
class fivecentplots.engines.layout.Element(label='None', fcpp={}, others={}, **kwargs)¶
- 
color_alpha(attr, alpha)¶
- Add alpha to each color in the color list and make it a RepeatedList 
 - 
kwargs¶
 - 
on¶
 - 
see()¶
- Prints a readable list of class attributes 
 - 
size¶
 - 
size_inches¶
 - 
text¶
 
- 
- 
class fivecentplots.engines.layout.Legend_Element(label='None', fcpp={}, others={}, **kwargs)¶
- 
add_value(key, curve, line_type_name)¶
- Add a new curve to the values dataframe - Parameters: - key (str) – string name for legend label
- curve (obj) – reference to curve obj
- line_type_name (str) – line type description
 
 - 
del_value(key)¶
 - 
set_default()¶
 - 
size¶
 - 
values¶
 
- 
- 
fivecentplots.engines.layout.custom_formatwarning(msg, *args, **kwargs)¶
mpl.py¶
- 
class fivecentplots.engines.mpl.Layout(plot_func, data, **kwargs)¶
- 
add_box_labels(ir, ic, data)¶
 - 
add_box_points(ir, ic, x, y)¶
- Plot x y points with or without jitter 
 - 
add_cbar(ax, contour)¶
- Add a color bar 
 - 
add_hvlines(ir, ic, df=None)¶
- Add axhlines and axvlines - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
- df (pd.DataFrame) – current data
 
 - 
add_label(ir, ic, text='', position=None, rotation=0, size=None, fill_color='#ffffff', edge_color='#aaaaaa', edge_width=1, font='sans-serif', font_weight='normal', font_style='normal', font_color='#666666', font_size=14, offset=False, **kwargs)¶
- Add a label to the plot - This function can be used for title labels or for group labels applied to rows and columns when plotting facet grid style plots. - Parameters: - label (str) – label text
- pos (tuple) – label position tuple of form (left, right, top, bottom)
- is (old) –
- axis (matplotlib.axes) – mpl axes object
- rotation (int) – degrees of rotation
- fillcolor (str) – hex color code for label fill (default=’#ffffff’)
- edgecolor (str) – hex color code for label edge (default=’#aaaaaa’)
- color (str) – hex color code for label text (default=’#666666’)
- weight (str) – label font weight (use standard mpl weights like ‘bold’)
- fontsize (int) – label font size (default=14)
 
 - 
add_legend()¶
- Add a figure legend
- TODO: add separate_label support?
 
 - 
add_text(ir, ic, text=None, element=None, offsetx=0, offsety=0, **kwargs)¶
- Add a text box 
 - 
close()¶
- Close existing plot windows 
 - 
fill_between_lines(ir, ic, iline, x, lcl, ucl, obj, twin=False)¶
- Shade a region between two curves - Args: 
 - 
get_axes_label_position()¶
- Get the position of the axes labels
- self.label_@.position –> [left, right, top, bottom]
 
 - 
get_element_sizes(data)¶
- Calculate the actual rendered size of select elements by pre-plotting them. This is needed to correctly adjust the figure dimensions - Parameters: - data (obj) – data class object 
 - 
get_figure_size(data, **kwargs)¶
- Determine the size of the mpl figure canvas in pixels and inches 
 - 
get_legend_position()¶
- Get legend position 
 - 
get_rc_label_position()¶
- Get option group label positions
- self.label.position –> [left, right, top, bottom]
 
 - 
get_subplots_adjust()¶
- Calculate the subplots_adjust parameters for the axes
- self.axes.position –> [left, right, top, bottom]
 
 - 
get_title_position()¶
- Calculate the title position
- self.title.position –> [left, right, top, bottom]
 
 - 
make_figure(data, **kwargs)¶
- Make the figure and axes objects 
 - 
plot_bar(ir, ic, iline, df, x, y, leg_name, data, stacked, std, ngroups=1)¶
- Plot bar graph 
 - 
plot_box(ir, ic, data, **kwargs)¶
- Plot boxplot data - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- data (pd.DataFrame) – data to plot
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the box plot object 
 - 
plot_contour(ax, df, x, y, z, ranges)¶
- Plot a contour plot 
 - 
plot_heatmap(ax, df, x, y, z, ranges)¶
- Plot a heatmap - Parameters: - ax (mpl.axes) – current axes obj
- df (pd.DataFrame) – data to plot
- x (str) – x-column name
- y (str) – y-column name
- z (str) – z-column name
- range (dict) – ax limits
 
 - 
plot_hist(ir, ic, iline, df, x, y, leg_name, data, zorder=1, line_type=None, marker_disable=False)¶
 - 
plot_line(ir, ic, x0, y0, x1=None, y1=None, **kwargs)¶
- Plot a simple line - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- x0 (float) – min x coordinate of line
- x1 (float) – max x coordinate of line
- y0 (float) – min y coordinate of line
- y1 (float) – max y coordinate of line
- kwargs – keyword args
 
 - 
plot_polygon(ir, ic, points, **kwargs)¶
- Plot a polygon - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- points (list of float) – points on the polygon
- kwargs – keyword args
 
 - 
plot_xy(ir, ic, iline, df, x, y, leg_name, twin, zorder=1, line_type=None, marker_disable=False)¶
- Plot xy data - Parameters: - x (np.array) – x data to plot
- y (np.array) – y data to plot
- color (str) – hex color code for line color (default=’#000000’)
- marker (str) – marker char string (default=’o’)
- points (bool) – toggle points on|off (default=False)
- line (bool) – toggle plot lines on|off (default=True)
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the line plot object 
 - 
save(filename, idx=0)¶
- Save a plot window - Parameters: - filename (str) – name of the file 
 - 
see()¶
- Prints a readable list of class attributes 
 - 
set_axes_colors(ir, ic)¶
- Set axes colors (fill, alpha, edge) - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
set_axes_grid_lines(ir, ic)¶
- Style the grid lines and toggle visibility - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
set_axes_labels(ir, ic)¶
- Set the axes labels - Parameters: - ir (int) – current row index
- ic (int) – current column index
- kw (dict) – kwargs dict
 
 - 
set_axes_ranges(ir, ic, ranges)¶
- Set the axes ranges - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
- limits (dict) – min/max axes limits for each axis
 
 - 
set_axes_ranges_hist(ir, ic, data, hist, iline)¶
- Special range overrides for histogram plot
- Needed to deal with the late computation of bin counts
 - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
- data (Data obj) – current data object
- hist (mpl.hist obj) – result of hist plot
 
 - 
set_axes_rc_labels(ir, ic)¶
- Add the row/column label boxes and wrap titles - Parameters: - ir (int) – current row index
- ic (int) – current column index
 
 - 
set_axes_scale(ir, ic)¶
- Set the scale type of the axes - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 - Returns: - axes scale type 
 - 
set_axes_ticks(ir, ic)¶
- Configure the axes tick marks - Parameters: - ax (mpl axes) – current axes to scale
- kw (dict) – kwargs dict
- y_only (bool) – flag to access on the y-axis ticks
 
 - 
set_colormap(data, **kwargs)¶
- Replace the color list with discrete values from a colormap - Parameters: - data (Data object) – 
 - 
set_figure_title()¶
- Add a figure title 
 - 
set_scientific(ax, idx=0)¶
- Turn off scientific notation - Parameters: - ax – axis to adjust - Returns: - updated axise 
 - 
show(filename=None)¶
- Handle display of the plot window 
 - 
update_subplot_spacing()¶
- Update spacing for long labels 
 
- 
- 
fivecentplots.engines.mpl.custom_formatwarning(msg, *args, **kwargs)¶
- 
fivecentplots.engines.mpl.iterticks(ax)¶
- 
fivecentplots.engines.mpl.mpl_get_ticks(ax, xon=True, yon=True)¶
- Divine a bunch of tick and label parameters for mpl layouts - Parameters: - ax (mpl.axes) – - Returns: - dict of x and y ax tick parameters 
- 
fivecentplots.engines.mpl.mplc_to_hex(color, alpha=True)¶
- Convert mpl color to hex - Parameters: - color (tuple) – matplotlib style color code
- alpha (boolean) – include or exclude the alpha value
 
bokeh.py¶
- 
class fivecentplots.engines.bokeh.Layout(plot_func, data, **kwargs)¶
- 
add_box_labels(ir, ic, dd)¶
 - 
add_hvlines(ir, ic, df=None)¶
 - 
add_legend()¶
- Add a figure legend 
 - 
add_text(ir, ic, text=None, element=None, offsetx=0, offsety=0, **kwargs)¶
- Add a text box 
 - 
get_element_sizes(data)¶
 - 
get_figure_size(data, **kwargs)¶
 - 
make_figure(data, **kwargs)¶
- Make the figure and axes objects 
 - 
plot_box(ir, ic, data, **kwargs)¶
- Plot boxplot data - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- data (pd.DataFrame) – data to plot
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the box plot object 
 - 
plot_contour(ax, df, x, y, z, ranges)¶
- Plot a contour plot 
 - 
plot_heatmap(ax, df, x, y, z, ranges)¶
- Plot a heatmap - Parameters: - ax (mpl.axes) – current axes obj
- df (pd.DataFrame) – data to plot
- x (str) – x-column name
- y (str) – y-column name
- z (str) – z-column name
- range (dict) – ax limits
 
 - 
plot_hist(ir, ic, iline, df, x, y, leg_name, data, zorder=1, line_type=None, marker_disable=False)¶
 - 
plot_line(ir, ic, x0, y0, x1=None, y1=None, **kwargs)¶
- Plot a simple line - Parameters: - ir (int) – subplot row index
- ic (int) – subplot column index
- x0 (float) – min x coordinate of line
- x1 (float) – max x coordinate of line
- y0 (float) – min y coordinate of line
- y1 (float) – max y coordinate of line
- kwargs – keyword args
 
 - 
plot_xy(ir, ic, iline, df, x, y, leg_name, twin, zorder=1, line_type=None, marker_disable=False)¶
- Plot xy data - Parameters: - x (np.array) – x data to plot
- y (np.array) – y data to plot
- color (str) – hex color code for line color (default=’#000000’)
- marker (str) – marker char string (default=’o’)
- points (bool) – toggle points on|off (default=False)
- line (bool) – toggle plot lines on|off (default=True)
 - Keyword Arguments: - kwargs allowed by the plotter function selected (any) – - Returns: - return the line plot object 
 - 
save(filename, idx=0)¶
 - 
see()¶
- Prints a readable list of class attributes 
 - 
set_axes_colors(ir, ic)¶
- Set axes colors (fill, alpha, edge) - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
set_axes_grid_lines(ir, ic)¶
- Style the grid lines and toggle visibility - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
 
 - 
set_axes_labels(ir, ic)¶
- Set the axes labels - Parameters: - ir (int) – current row index
- ic (int) – current column index
- kw (dict) – kwargs dict
 
 - 
set_axes_ranges(ir, ic, ranges)¶
- Set the axes ranges - Parameters: - ir (int) – subplot row index
- ic (int) – subplot col index
- limits (dict) – min/max axes limits for each axis
 
 - 
set_axes_rc_labels(ir, ic)¶
 - 
set_axes_scale(ir, ic)¶
 - 
set_axes_scale2(ir, ic)¶
- This appears to need to happen at instantiation of the figure 
 - 
set_axes_ticks(ir, ic)¶
 - 
set_figure_title()¶
- Add a figure title 
 - 
show(filename=None)¶
- Handle display of the plot window 
 
- 
- 
fivecentplots.engines.bokeh.custom_formatwarning(msg, *args, **kwargs)¶
- 
fivecentplots.engines.bokeh.fill_alpha(hexstr)¶
- Break an 8-digit hex string into a hex color and a fractional alpha value 
- 
fivecentplots.engines.bokeh.format_marker(fig, marker)¶
- Format the marker string to mathtext 
utilities.py¶
- 
exception fivecentplots.utilities.PlatformError¶
- 
fivecentplots.utilities.ci(data, coeff=0.95)¶
- Compute the confidence interval - Parameters: - data (pd.Series) – raw data for computation - Returns: - lower confidence interval, upper confidence interval returns np.nan if standard err < 0 
- 
fivecentplots.utilities.df_filter(df, filt_orig, drop_cols=False)¶
- Filter the DataFrame - Due to limitations in pd.query, column names must not have spaces. This function will temporarily replace spaces in the column names with underscores, but the supplied query string must contain column names without any spaces - Parameters: - df (pd.DataFrame) – DataFrame to filter
- filt_orig (str) – query expression for filtering
- drop_cols (bool) – drop filtered columns from results
 - Returns: - filtered DataFrame 
- 
fivecentplots.utilities.df_summary(df, columns=[], exclude=[], multiple=False)¶
- Return a summary table of unique conditions in a DataFrame - If more than one value exists, replace with “Multiple” or a string list of the values - Parameters: - df (pd.DataFrame) – input DataFrame
- columns (list) – list of column names to include; if empty, include all columns
- exclude (list) – list of column names to ignore
- multiple (bool) – toggle between showing discrete values or “Multiple” when a column contains more than one value
 
- 
fivecentplots.utilities.df_unique(df)¶
- Get column names with one unique value - Parameters: - df (pd.DataFrame) – data to check - Returns: - dict of col names and unique values 
- 
fivecentplots.utilities.dfkwarg(args, kwargs)¶
- Add the DataFrame to kwargs - Parameters: - Returns: - updated kwargs 
- 
fivecentplots.utilities.get_current_values(df, text, key='@')¶
- Parse a string looking for text enclosed by ‘key’ and replace with the current value from the DataFrame - Parameters: - df (pd.DataFrame) – DataFrame containing values we are looking for
- text (str) – string to parse
- key (str) – matching chars that enclose the value to replace from df
 - Returns: - updated string 
- 
fivecentplots.utilities.get_decimals(value, max_places=4)¶
- Get the number of decimal places of a float number excluding rounding errors - Parameters: - value (int|float) – value to check
- max_places (int) – maximum number of decimal places to check
 - Returns: - number of decimal places 
- 
fivecentplots.utilities.get_mpl_version_dir()¶
- Get the matplotlib version directory for test images based on the current version of mpl 
- 
fivecentplots.utilities.get_text_dimensions(text, **kwargs)¶
- 
fivecentplots.utilities.img_compare(img1, img2)¶
- Read two images and compare for difference by pixel - This is an optional utility used only for developer tests, so the function will only work if opencv is installed - Parameters: - img1 (str) – path to file #1
- img2 (str) – path to file #2
 - Returns: - True/False of existance of differences 
- 
fivecentplots.utilities.kwget(dict1, dict2, val, default)¶
- Augmented kwargs.get function - Parameters: - dict1 (dict) – first dictionary to check for the value
- dict2 (dict) – second dictionary to check for the value
- val (str) – value to look for
- default (multiple) – default value if not found in dict1 or dict2 keys
 - Returns: - value to use 
- 
fivecentplots.utilities.nq(data, column='Value', **kwargs)¶
- Normal quantile calculation 
- 
fivecentplots.utilities.plot_num(ir, ic, ncol)¶
- Get the plot number based on grid location 
- 
fivecentplots.utilities.rectangle_overlap(r1, r2)¶
- Determine if the bounds of two rectangles overlap - Parameters: - r1 (list|tuple) – width, height, center point (x, y) of left rectangle
- r2 (list|tuple) – width, height, center point (x, y) of right rectangle
 - Returns: - True if overlap | False if not 
- 
fivecentplots.utilities.reload_defaults(theme=None)¶
- Reload the fcp params 
- 
fivecentplots.utilities.set_save_filename(df, ifig, fig_item, fig_cols, layout, kwargs)¶
- Build a filename based on the plot setup parameters - Parameters: - df (pd.DataFrame) – input data used for the plot
- fig_item (None | str) – unique figure item
- fig_cols (None | str | list) – names of columns used to generate fi
- layout (obj) – plot layout object
- kwargs (dict) – input keyword args
 - Returns: - str filename 
- 
fivecentplots.utilities.sigma(x)¶
- Calculate the sigma range for a data set - Parameters: - x (pd.Series | np.array) – data set - Returns: - int value to use for +/- max sigma 
- 
fivecentplots.utilities.validate_list(items)¶
- Make sure a list variable is actually a list and not a single string - Parameters: - items (str|list) – values to check dtype - Returns: - items as a list