epistasis.pyplot package

epistasis.pyplot.coefs module

epistasis.pyplot.coefs.plot_coefs(model=None, sites=None, values=None, errors=None, **kwargs)

Create a barplot with the values from model, drawing the x-axis as a grid of boxes indicating the coordinate of the epistatic parameter. Should automatically generate an almost publication-quality figure.

Parameters:
  • model (BaseModel object) – epistasis model.
  • sites (array) – array of epistatic indices/sites.
  • values (array) – an array of epistatic coefficients
  • errors (2d array or list) – upper and lower bounds for each beta.
Keyword Arguments:
 
  • logbase (numpy.ufunc (default=np.log10)) – function to transform into log space
  • log_transform (bool (default=False)) – transform the values if true.
  • order_colors – list/tuple of colors for each order (rgb,html string-like)
  • significance – how to treat signifiance. should be 1. “bon” -> Bonferroni corrected p-values (default) 2. “p” -> raw p-values 3. None -> ignore significance
  • significance_cutoff – value above which to consider a term significant
  • sigmas – number of sigmas to show for each error bar
  • y_scalar – how much to scale the y-axis above and beyond y-max
  • y_axis_name – what to put on the y-axis of the barplot
  • figsize – tuple of figure width,height
  • height_ratio – how much to scale barplot relative to xbox
  • star_cutoffs
    signifiance cutoffs for star stack. should go from highest
    p to lowest p (least to most significant)
  • star_spacer – constant that scales how closely stacked stars are from one another
  • ybounds (tuple (default=None)) –
  • bar_borders (bool (default=True)) –
  • xgrid (bool (default=True)) –
  • ecolor (color (default='black')) –
  • elinewidth (float (default=1)) –
  • capthick (float (default=1)) –
  • capsize (float (default=1)) –
  • gridlines (float (default=1)) – x grid linewidth
Returns:

  • fig (matplotlib.pyplot.Figure) – Figure object
  • ax (matplotlib.pyplot.Axes) – Axes object

epistasis.pyplot.nonlinear module

epistasis.pyplot.nonlinear.plot_power_transform(model=None, yadd=None, yobs=None, yerr=None, function=None, cmap=None, color=None, s=50, alpha=1, ax=None, function_line=True, line_color='r', **kwargs)

Plot a Y_obs vs. Y_add showing the nonlinear scale in a genotype-phenotype map.

Parameters:
  • model ((default=None)) – Epistasis model.
  • yadd (array (default=None)) – x-axis data. The additive model phenotypes.
  • yobs (array (default=None)) – y-axis data. The observed phenotypes.
  • yerr (array (default=None)) – y-axis error. Error in observed phenotypes.
  • function (callable) – Nonlinear function.
  • cmap (str) – Colormap name to map onto scatter points.
  • color (str, array,) – color of phenotypes.
  • s (int) – size of scatter points.
  • ax (Axes) – Axes object to plot points on.
  • function_line (bool) – If true, plots nonlinear function on top of points.
  • line_color (matplotlib color.) – color of function line.
Returns:

ax – Axes object with plot.

Return type:

matplotlib.Axes

epistasis.pyplot.nonlinear.plot_scale(model=None, yadd=None, yobs=None, yerr=None, function=None, cmap=None, color=None, s=50, alpha=1, ax=None, function_line=True, line_color='r', **kwargs)

Plot a Y_obs vs. Y_add showing the nonlinear scale in a genotype-phenotype map.

Parameters:
  • model ((default=None)) – Epistasis model.
  • yadd (array (default=None)) – x-axis data. The additive model phenotypes.
  • yobs (array (default=None)) – y-axis data. The observed phenotypes.
  • yerr (array (default=None)) – y-axis error. Error in observed phenotypes.
  • function (callable) – Nonlinear function.
  • cmap (str) – Colormap name to map onto scatter points.
  • color (str, array,) – color of phenotypes.
  • s (int) – size of scatter points.
  • ax (Axes) – Axes object to plot points on.
  • function_line (bool) – If true, plots nonlinear function on top of points.
  • line_color (matplotlib color.) – color of function line.
Returns:

ax – Axes object with plot.

Return type:

matplotlib.Axes