FlowCal.plot module

Functions for visualizing flow cytometry data.

Functions in this module are divided in two categories:

  • Simple Plot Functions, with a signature similar to the following:

    plot_fxn(data_list, channels, parameters, savefig)
    

    where data_list is a NxD FCSData object or numpy array, or a list of such, channels specifies the channel or channels to use for the plot, parameters are function-specific parameters, and savefig indicates whether to save the figure to an image file. Note that hist1d, violin, and violin_dose_response use channel instead of channels, since they use a single channel, and density2d only accepts one FCSData object or numpy array as its first argument.

    Simple Plot Functions do not create a new figure or axis, so they can be called directly to plot in a previously created axis if desired. If savefig is not specified, the plot is maintained in the current axis when the function returns. This allows for further modifications to the axis by direct calls to, for example, plt.xlabel, plt.title, etc. However, if savefig is specified, the figure is closed after being saved. In this case, the function may include keyword parameters xlabel, ylabel, xlim, ylim, title, and others related to legend or color, which allow the user to modify the axis prior to saving.

    The following functions in this module are Simple Plot Functions:

    • hist1d
    • violin
    • violin_dose_response
    • density2d
    • scatter2d
    • scatter3d
  • Complex Plot Functions, which create a figure with several axes, and use one or more Simple Plot functions to populate the axes. They always include a savefig argument, which indicates whether to save the figure to a file. If savefig is not specified, the plot is maintained in the newly created figure when the function returns. However, if savefig is specified, the figure is closed after being saved.

    The following functions in this module are Complex Plot Functions:

    • density_and_hist
    • scatter3d_and_projections
FlowCal.plot.density2d(data, channels=[0, 1], bins=1024, mode='mesh', normed=False, smooth=True, sigma=10.0, colorbar=False, xscale='logicle', yscale='logicle', xlabel=None, ylabel=None, xlim=None, ylim=None, title=None, savefig=None, **kwargs)

Plot a 2D density plot from two channels of a flow cytometry data set.

density2d has two plotting modes which are selected using the mode argument. With mode=='mesh', this function plots the data as a true 2D histogram, in which a plane is divided into bins and the color of each bin is directly related to the number of elements therein. With mode=='scatter', this function also calculates a 2D histogram, but it plots a 2D scatter plot in which each dot corresponds to a bin, colored according to the number elements therein. The most important difference is that the scatter mode does not color regions corresponding to empty bins. This allows for easy identification of regions with low number of events. For both modes, the calculated histogram can be smoothed using a Gaussian kernel by specifying smooth=True. The width of the kernel is, in this case, given by sigma.

Parameters:
data : FCSData or numpy array

Flow cytometry data to plot.

channels : list of int, list of str, optional

Two channels to use for the plot.

bins : int or array_like or [int, int] or [array, array], optional

Bins used for plotting:

  • If None, use data.hist_bins to obtain bin edges for both axes. None is not allowed if data.hist_bins is not available.
  • If int, bins specifies the number of bins to use for both axes. If data.hist_bins exists, it will be used to generate a number bins of bins.
  • If array_like, bins directly specifies the bin edges to use for both axes.
  • If [int, int], each element of bins specifies the number of bins for each axis. If data.hist_bins exists, use it to generate bins[0] and bins[1] bin edges, respectively.
  • If [array, array], each element of bins directly specifies the bin edges to use for each axis.
  • Any combination of the above, such as [int, array], [None, int], or [array, int]. In this case, None indicates to generate bin edges using data.hist_bins as above, int indicates the number of bins to generate, and an array directly indicates the bin edges. Note that None is not allowed if data.hist_bins does not exist.
mode : {‘mesh’, ‘scatter’}, str, optional

Plotting mode. ‘mesh’ produces a 2D-histogram whereas ‘scatter’ produces a scatterplot colored by histogram bin value.

normed : bool, optional

Flag indicating whether to plot a normed histogram (probability mass function instead of a counts-based histogram).

smooth : bool, optional

Flag indicating whether to apply Gaussian smoothing to the histogram.

colorbar : bool, optional

Flag indicating whether to add a colorbar to the plot.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
sigma : float, optional

The sigma parameter for the Gaussian kernel to use when smoothing.

xscale : str, optional

Scale of the x axis, either linear, log, or logicle.

yscale : str, optional

Scale of the y axis, either linear, log, or logicle

xlabel : str, optional

Label to use on the x axis. If None, attempts to extract channel name from data.

ylabel : str, optional

Label to use on the y axis. If None, attempts to extract channel name from data.

xlim : tuple, optional

Limits for the x axis. If not specified and bins exists, use the lowest and highest values of bins.

ylim : tuple, optional

Limits for the y axis. If not specified and bins exists, use the lowest and highest values of bins.

title : str, optional

Plot title.

kwargs : dict, optional

Additional parameters passed directly to the underlying matplotlib functions: plt.scatter if mode==scatter, and plt.pcolormesh if mode==mesh.

FlowCal.plot.density_and_hist(data, gated_data=None, gate_contour=None, density_channels=None, density_params={}, hist_channels=None, hist_params={}, figsize=None, savefig=None)

Make a combined density/histogram plot of a FCSData object.

This function calls hist1d and density2d to plot a density diagram and a number of histograms in different subplots of the same plot using one single function call. Setting density_channels to None will not produce a density diagram, and setting hist_channels to None will not produce any histograms. Setting both to None will raise an error. Additional parameters can be provided to density2d and hist1d by using density_params and hist_params.

If gated_data is provided, this function will plot the histograms corresponding to gated_data on top of data’s histograms, with some transparency on data. In addition, a legend will be added with the labels ‘Ungated’ and ‘Gated’. If gate_contour is provided and it contains a valid list of 2D curves, these will be plotted on top of the density plot.

Parameters:
data : FCSData object

Flow cytometry data object to plot.

gated_data : FCSData object, optional

Flow cytometry data object. If gated_data is specified, the histograms of data are plotted with an alpha value of 0.5, and the histograms of gated_data are plotted on top of those with an alpha value of 1.0.

gate_contour : list, optional

List of Nx2 curves, representing a gate contour to be plotted in the density diagram.

density_channels : list

Two channels to use for the density plot. If density_channels is None, do not plot a density plot.

density_params : dict, optional

Parameters to pass to density2d.

hist_channels : list

Channels to use for each histogram. If hist_channels is None, do not plot histograms.

hist_params : list, optional

List of dictionaries with the parameters to pass to each call of hist1d.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
figsize : tuple, optional

Figure size. If None, calculate a default based on the number of subplots.

Raises:
ValueError

If both density_channels and hist_channels are None.

FlowCal.plot.hist1d(data_list, channel=0, xscale='logicle', bins=256, histtype='stepfilled', normed_area=False, normed_height=False, xlabel=None, ylabel=None, xlim=None, ylim=None, title=None, legend=False, legend_loc='best', legend_fontsize='medium', legend_labels=None, facecolor=None, edgecolor=None, savefig=None, **kwargs)

Plot one 1D histogram from one or more flow cytometry data sets.

Parameters:
data_list : FCSData or numpy array or list of FCSData or numpy array

Flow cytometry data to plot.

channel : int or str, optional

Channel from where to take the events to plot. If ndim == 1, channel is ignored. String channel specifications are only supported for data types which support string-based indexing (e.g. FCSData).

xscale : str, optional

Scale of the x axis, either linear, log, or logicle.

bins : int or array_like, optional

If bins is an integer, it specifies the number of bins to use. If bins is an array, it specifies the bin edges to use. If bins is None or an integer, hist1d will attempt to use data.hist_bins to generate the bins automatically.

histtype : {‘bar’, ‘barstacked’, ‘step’, ‘stepfilled’}, str, optional

Histogram type. Directly passed to plt.hist.

normed_area : bool, optional

Flag indicating whether to normalize the histogram such that the area under the curve is equal to one. The resulting plot is equivalent to a probability density function.

normed_height : bool, optional

Flag indicating whether to normalize the histogram such that the sum of all bins’ heights is equal to one. The resulting plot is equivalent to a probability mass function. normed_height is ignored if normed_area is True.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xlabel : str, optional

Label to use on the x axis. If None, attempts to extract channel name from last data object.

ylabel : str, optional

Label to use on the y axis. If None and normed_area==True, use ‘Probability’. If None, normed_area==False, and normed_height==True, use ‘Counts (normalized)’. If None, normed_area==False, and normed_height==False, use ‘Counts’.

xlim : tuple, optional

Limits for the x axis. If not specified and bins exists, use the lowest and highest values of bins.

ylim : tuple, optional

Limits for the y axis.

title : str, optional

Plot title.

legend : bool, optional

Flag specifying whether to include a legend. If legend is True, the legend labels will be taken from legend_labels if present, else they will be taken from str(data_list[i]).

legend_loc : str, optional

Location of the legend.

legend_fontsize : int or str, optional

Font size for the legend.

legend_labels : list, optional

Labels to use for the legend.

facecolor : matplotlib color or list of matplotlib colors, optional

The histogram’s facecolor. It can be a list with the same length as data_list. If edgecolor and facecolor are not specified, and histtype == 'stepfilled', the facecolor will be taken from the module-level variable cmap_default.

edgecolor : matplotlib color or list of matplotlib colors, optional

The histogram’s edgecolor. It can be a list with the same length as data_list. If edgecolor and facecolor are not specified, and histtype == 'step', the edgecolor will be taken from the module-level variable cmap_default.

kwargs : dict, optional

Additional parameters passed directly to matploblib’s hist.

Notes

hist1d calls matplotlib’s hist function for each object in data_list. hist_type, the type of histogram to draw, is directly passed to plt.hist. Additional keyword arguments provided to hist1d are passed directly to plt.hist.

If normed_area is set to True, hist1d calls plt.hist with density (or normed, if matplotlib’s version is older than 2.2.0) set to True. There is a bug in matplotlib 2.1.0 that produces an incorrect plot in these conditions. We do not recommend using matplotlib 2.1.0 if normed_area is expected to be used.

FlowCal.plot.scatter2d(data_list, channels=[0, 1], xscale='logicle', yscale='logicle', xlabel=None, ylabel=None, xlim=None, ylim=None, title=None, color=None, savefig=None, **kwargs)

Plot 2D scatter plot from one or more FCSData objects or numpy arrays.

Parameters:
data_list : array or FCSData or list of array or list of FCSData

Flow cytometry data to plot.

channels : list of int, list of str

Two channels to use for the plot.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xscale : str, optional

Scale of the x axis, either linear, log, or logicle.

yscale : str, optional

Scale of the y axis, either linear, log, or logicle.

xlabel : str, optional

Label to use on the x axis. If None, attempts to extract channel name from last data object.

ylabel : str, optional

Label to use on the y axis. If None, attempts to extract channel name from last data object.

xlim : tuple, optional

Limits for the x axis. If None, attempts to extract limits from the range of the last data object.

ylim : tuple, optional

Limits for the y axis. If None, attempts to extract limits from the range of the last data object.

title : str, optional

Plot title.

color : matplotlib color or list of matplotlib colors, optional

Color for the scatter plot. It can be a list with the same length as data_list. If color is not specified, elements from data_list are plotted with colors taken from the module-level variable cmap_default.

kwargs : dict, optional

Additional parameters passed directly to matploblib’s scatter.

Notes

scatter2d calls matplotlib’s scatter function for each object in data_list. Additional keyword arguments provided to scatter2d are passed directly to plt.scatter.

FlowCal.plot.scatter3d(data_list, channels=[0, 1, 2], xscale='logicle', yscale='logicle', zscale='logicle', xlabel=None, ylabel=None, zlabel=None, xlim=None, ylim=None, zlim=None, title=None, color=None, savefig=None, **kwargs)

Plot 3D scatter plot from one or more FCSData objects or numpy arrays.

Parameters:
data_list : array or FCSData or list of array or list of FCSData

Flow cytometry data to plot.

channels : list of int, list of str

Three channels to use for the plot.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xscale : str, optional

Scale of the x axis, either linear, log, or logicle.

yscale : str, optional

Scale of the y axis, either linear, log, or logicle.

zscale : str, optional

Scale of the z axis, either linear, log, or logicle.

xlabel : str, optional

Label to use on the x axis. If None, attempts to extract channel name from last data object.

ylabel : str, optional

Label to use on the y axis. If None, attempts to extract channel name from last data object.

zlabel : str, optional

Label to use on the z axis. If None, attempts to extract channel name from last data object.

xlim : tuple, optional

Limits for the x axis. If None, attempts to extract limits from the range of the last data object.

ylim : tuple, optional

Limits for the y axis. If None, attempts to extract limits from the range of the last data object.

zlim : tuple, optional

Limits for the z axis. If None, attempts to extract limits from the range of the last data object.

title : str, optional

Plot title.

color : matplotlib color or list of matplotlib colors, optional

Color for the scatter plot. It can be a list with the same length as data_list. If color is not specified, elements from data_list are plotted with colors taken from the module-level variable cmap_default.

kwargs : dict, optional

Additional parameters passed directly to matploblib’s scatter.

Notes

scatter3d uses matplotlib’s scatter with a 3D projection. Additional keyword arguments provided to scatter3d are passed directly to scatter.

FlowCal.plot.scatter3d_and_projections(data_list, channels=[0, 1, 2], xscale='logicle', yscale='logicle', zscale='logicle', xlabel=None, ylabel=None, zlabel=None, xlim=None, ylim=None, zlim=None, color=None, figsize=None, savefig=None, **kwargs)

Plot a 3D scatter plot and 2D projections from FCSData objects.

scatter3d_and_projections creates a 3D scatter plot and three 2D projected scatter plots in four different axes for each FCSData object in data_list, in the same figure.

Parameters:
data_list : FCSData object, or list of FCSData objects

Flow cytometry data to plot.

channels : list of int, list of str

Three channels to use for the plot.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xscale : str, optional

Scale of the x axis, either linear, log, or logicle.

yscale : str, optional

Scale of the y axis, either linear, log, or logicle.

zscale : str, optional

Scale of the z axis, either linear, log, or logicle.

xlabel : str, optional

Label to use on the x axis. If None, attempts to extract channel name from last data object.

ylabel : str, optional

Label to use on the y axis. If None, attempts to extract channel name from last data object.

zlabel : str, optional

Label to use on the z axis. If None, attempts to extract channel name from last data object.

xlim : tuple, optional

Limits for the x axis. If None, attempts to extract limits from the range of the last data object.

ylim : tuple, optional

Limits for the y axis. If None, attempts to extract limits from the range of the last data object.

zlim : tuple, optional

Limits for the z axis. If None, attempts to extract limits from the range of the last data object.

color : matplotlib color or list of matplotlib colors, optional

Color for the scatter plot. It can be a list with the same length as data_list. If color is not specified, elements from data_list are plotted with colors taken from the module-level variable cmap_default.

figsize : tuple, optional

Figure size. If None, use matplotlib’s default.

kwargs : dict, optional

Additional parameters passed directly to matploblib’s scatter.

Notes

scatter3d_and_projections uses matplotlib’s scatter, with the 3D scatter plot using a 3D projection. Additional keyword arguments provided to scatter3d_and_projections are passed directly to scatter.

FlowCal.plot.violin(data, channel=None, positions=None, violin_width=None, xscale=None, yscale=None, xlim=None, ylim=None, vert=True, num_bins=100, bin_edges=None, density=False, upper_trim_fraction=0.01, lower_trim_fraction=0.01, violin_width_to_span_fraction=0.1, violin_kwargs=None, draw_summary_stat=True, draw_summary_stat_fxn=<function mean>, draw_summary_stat_kwargs=None, log_zero_tick_label=None, draw_log_zero_divider=True, draw_log_zero_divider_kwargs=None, xlabel=None, ylabel=None, title=None, savefig=None)

Plot violin plot.

Illustrate the relative frequency of members of different populations using normalized, symmetrical histograms (“violins”) centered at corresponding positions. Wider regions of violins indicate regions that occur with greater frequency.

Parameters:
data : 1D or ND array or list of 1D or ND arrays

A population or collection of populations for which to plot violins. If ND arrays are used (e.g., FCSData), channel must be specified.

channel : int or str, optional

Channel from data to plot. If specified, data are assumed to be ND arrays. String channel specifications are only supported for data types that support string-based indexing (e.g., FCSData).

positions : scalar or array, optional

Positions at which to center violins.

violin_width : scalar, optional

Width of violin. If the scale of the position axis (xscale if vert is True, yscale if vert is False) is log, the units are decades. If not specified, violin_width is calculated from the limits of the position axis (xlim if vert is True, ylim if vert is False) and violin_width_to_span_fraction. If only one violin is specified in data, violin_width = 0.5.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xscale : {‘linear’, ‘log’, ‘logicle’}, optional

Scale of the x-axis. logicle is only supported for horizontal violin plots (i.e., when vert is False). Default is linear if vert is True, logicle if vert is False.

yscale : {‘logicle’, ‘linear’, ‘log’}, optional

Scale of the y-axis. If vert is False, logicle is not supported. Default is logicle if vert is True, linear if vert is False.

xlim, ylim : tuple, optional

Limits of the x-axis and y-axis views. If not specified, the view of the position axis (xlim if vert is True, ylim if vert if False) is calculated to pad the extreme violins with 0.5 * violin_width. If violin_width is also not specified, violin_width is calculated to satisfy the 0.5 * violin_width padding and violin_width_to_span_fraction. If not specified, the view of the data axis (ylim if vert is True, xlim if vert is False) is calculated to span all violins (before they are aesthetically trimmed).

vert : bool, optional

Flag specifying to illustrate a vertical violin plot. If False, a horizontal violin plot is illustrated.

num_bins : int, optional

Number of bins to bin population members. Ignored if bin_edges is specified.

bin_edges : array or list of arrays, optional

Bin edges used to bin population members. Bin edges can be specified for individual violins using a list of arrays of the same length as data. If not specified, bin_edges is calculated to span the data axis (ylim if vert is True, xlim if vert is False) logicly, linearly, or logarithmically (based on the scale of the data axis; yscale if vert is True, xscale if vert is False) using num_bins.

density : bool, optional

density parameter passed to the np.histogram() command that bins population members for each violin. If True, violin width represents relative frequency density instead of relative frequency (i.e., bins are normalized by their width).

upper_trim_fraction : float or list of floats, optional

Fraction of members to trim (discard) from the top of the violin (e.g., for aesthetic purposes). Upper trim fractions can be specified for individual violins using a list of floats of the same length as data.

lower_trim_fraction : float or list of floats, optional

Fraction of members to trim (discard) from the bottom of the violin (e.g., for aesthetic purposes). Lower trim fractions can be specified for individual violins using a list of floats of the same length as data.

violin_width_to_span_fraction : float, optional

Fraction of the position axis span (xlim if vert is True, ylim if vert is False) that a violin should span. Ignored if violin_width is specified.

violin_kwargs : dict or list of dicts, optional

Keyword arguments passed to the plt.fill_between() command that illustrates each violin. Keyword arguments can be specified for individual violins using a list of dicts of the same length as data. Default = {‘facecolor’:’gray’, ‘edgecolor’:’black’}.

draw_summary_stat : bool, optional

Flag specifying to illustrate a summary statistic for each violin.

draw_summary_stat_fxn : function, optional

Function used to calculate the summary statistic for each violin. Summary statistics are calculated prior to aesthetic trimming.

draw_summary_stat_kwargs : dict or list of dicts, optional

Keyword arguments passed to the plt.plot() command that illustrates each violin’s summary statistic. Keyword arguments can be specified for individual violins using a list of dicts of the same length as data. Default = {‘color’:’black’}.

log_zero_tick_label : str, optional

Label of position=0 violin tick if the position axis scale (xscale if vert is True, yscale if vert is False) is log. Default is generated by the default log tick formatter (matplotlib.ticker.LogFormatterSciNotation) with x=0.

draw_log_zero_divider : bool, optional

Flag specifying to illustrate a line separating the position=0 violin from the other violins if the position axis scale (xscale if vert is True, yscale if vert is False) is log.

draw_log_zero_divider_kwargs : dict, optional

Keyword arguments passed to the plt.axvline() or plt.axhline() command that illustrates the position=0 violin divider. Default = {‘color’:’gray’,’linestyle’:’:’}.

xlabel, ylabel : str, optional

Labels to use on the x and y axes. If a label for the data axis is not specified (ylabel if vert is True, xlabel if vert is False), the channel name will be used if possible (extracted from the last data object).

title : str, optional

Plot title.

FlowCal.plot.violin_dose_response(data, channel=None, positions=None, min_data=None, max_data=None, violin_width=None, model_fxn=None, xscale='linear', yscale='logicle', xlim=None, ylim=None, violin_width_to_span_fraction=0.1, num_bins=100, bin_edges=None, density=False, upper_trim_fraction=0.01, lower_trim_fraction=0.01, violin_kwargs=None, draw_summary_stat=True, draw_summary_stat_fxn=<function mean>, draw_summary_stat_kwargs=None, log_zero_tick_label=None, min_bin_edges=None, min_upper_trim_fraction=0.01, min_lower_trim_fraction=0.01, min_violin_kwargs=None, min_draw_summary_stat_kwargs=None, draw_min_line=True, draw_min_line_kwargs=None, min_tick_label='Min', max_bin_edges=None, max_upper_trim_fraction=0.01, max_lower_trim_fraction=0.01, max_violin_kwargs=None, max_draw_summary_stat_kwargs=None, draw_max_line=True, draw_max_line_kwargs=None, max_tick_label='Max', draw_model_kwargs=None, draw_log_zero_divider=True, draw_log_zero_divider_kwargs=None, draw_minmax_divider=True, draw_minmax_divider_kwargs=None, xlabel=None, ylabel=None, title=None, savefig=None)

Plot violin plot with min data, max data, and mathematical model.

Plot a violin plot (see FlowCal.plot.violin() description) with vertical violins and separately illustrate a min violin, a max violin, and a mathematical model. Useful for illustrating “dose response” or “transfer” functions, which benefit from the added context of minimum and maximum bounds and which are often described by mathematical models. Min and max violins are illustrated to the left of the plot, and the mathematical model is correctly illustrated even when a position=0 violin is illustrated separately when xscale is log.

Parameters:
data : 1D or ND array or list of 1D or ND arrays

A population or collection of populations for which to plot violins. If ND arrays are used (e.g., FCSData), channel must be specified.

channel : int or str, optional

Channel from data to plot. If specified, data are assumed to be ND arrays. String channel specifications are only supported for data types that support string-based indexing (e.g., FCSData).

positions : scalar or array, optional

Positions at which to center violins.

min_data : 1D or ND array, optional

A population representing a minimum control. This violin is separately illustrated at the left of the plot.

max_data : 1D or ND array, optional

A population representing a maximum control. This violin is separately illustrated at the left of the plot.

violin_width : scalar, optional

Width of violin. If xscale is log, the units are decades. If not specified, violin_width is calculated from xlim and violin_width_to_span_fraction. If only one violin is specified in data, violin_width = 0.5.

model_fxn : function, optional

Function used to calculate model y-values. 100 x-values are linearly (if xscale is linear) or logarithmically (if xscale is log) generated spanning xlim. If xscale is log and a position=0 violin is specified, the result of model_fxn(0.0) is illustrated as a horizontal line with the position=0 violin.

savefig : str, optional

The name of the file to save the figure to. If None, do not save.

Other Parameters:
 
xscale : {‘linear’, ‘log’}, optional

Scale of the x-axis.

yscale : {‘logicle’, ‘linear’, ‘log’}, optional

Scale of the y-axis.

xlim : tuple, optional

Limits of the x-axis view. If not specified, xlim is calculated to pad leftmost and rightmost violins with 0.5 * violin_width. If violin_width is also not specified, violin_width is calculated to satisfy the 0.5 * violin_width padding and violin_width_to_span_fraction.

ylim : tuple, optional

Limits of the y-axis view. If not specified, ylim is calculated to span all violins (before they are aesthetically trimmed).

violin_width_to_span_fraction : float, optional

Fraction of the x-axis span that a violin should span. Ignored if violin_width is specified.

num_bins : int, optional

Number of bins to bin population members. Ignored if bin_edges is specified.

bin_edges : array or list of arrays, optional

Bin edges used to bin population members for data violins. Bin edges can be specified for individual violins using a list of arrays of the same length as data. If not specified, bin_edges is calculated to span ylim logicly (if yscale is logicle), linearly (if yscale is linear), or logarithmically (if yscale is log) using num_bins.

density : bool, optional

density parameter passed to the np.histogram() command that bins population members for each violin. If True, violin width represents relative frequency density instead of relative frequency (i.e., bins are normalized by their width).

upper_trim_fraction : float or list of floats, optional

Fraction of members to trim (discard) from the top of the data violins (e.g., for aesthetic purposes). Upper trim fractions can be specified for individual violins using a list of floats of the same length as data.

lower_trim_fraction : float or list of floats, optional

Fraction of members to trim (discard) from the bottom of the data violins (e.g., for aesthetic purposes). Lower trim fractions can be specified for individual violins using a list of floats of the same length as data.

violin_kwargs : dict or list of dicts, optional

Keyword arguments passed to the plt.fill_betweenx() command that illustrates the data violins. Keyword arguments can be specified for individual violins using a list of dicts of the same length as data. Default = {‘facecolor’:’gray’, ‘edgecolor’:’black’}.

draw_summary_stat : bool, optional

Flag specifying to illustrate a summary statistic for each violin.

draw_summary_stat_fxn : function, optional

Function used to calculate the summary statistic for each violin. Summary statistics are calculated prior to aesthetic trimming.

draw_summary_stat_kwargs : dict or list of dicts, optional

Keyword arguments passed to the plt.plot() command that illustrates the data violin summary statistics. Keyword arguments can be specified for individual violins using a list of dicts of the same length as data. Default = {‘color’:’black’}.

log_zero_tick_label : str, optional

Label of position=0 violin tick if xscale is log. Default is generated by the default log tick formatter (matplotlib.ticker.LogFormatterSciNotation) with x=0.

min_bin_edges : array, optional

Bin edges used to bin population members for the min violin. If not specified, min_bin_edges is calculated to span ylim logicaly (if yscale is logicle), linearly (if yscale is linear), or logarithmically (if yscale is log) using num_bins.

min_upper_trim_fraction : float, optional

Fraction of members to trim (discard) from the top of the min violin.

min_lower_trim_fraction : float, optional

Fraction of members to trim (discard) from the bottom of the min violin.

min_violin_kwargs : dict, optional

Keyword arguments passed to the plt.fill_betweenx() command that illustrates the min violin. Default = {‘facecolor’:’black’, ‘edgecolor’:’black’}.

min_draw_summary_stat_kwargs : dict, optional

Keyword arguments passed to the plt.plot() command that illustrates the min violin summary statistic. Default = {‘color’:’gray’}.

draw_min_line : bool, optional

Flag specifying to illustrate a line from the min violin summary statistic across the plot.

draw_min_line_kwargs : dict, optional

Keyword arguments passed to the plt.plot() command that illustrates the min violin line. Default = {‘color’:’gray’, ‘linestyle’:’–’, ‘zorder’:-2}.

min_tick_label : str, optional

Label of min violin tick. Default=’Min’.

max_bin_edges : array, optional

Bin edges used to bin population members for the max violin. If not specified, max_bin_edges is calculated to span ylim logicaly (if yscale is logicle), linearly (if yscale is linear), or logarithmically (if yscale is log) using num_bins.

max_upper_trim_fraction : float, optional

Fraction of members to trim (discard) from the top of the max violin.

max_lower_trim_fraction : float, optional

Fraction of members to trim (discard) from the bottom of the max violin.

max_violin_kwargs : dict, optional

Keyword arguments passed to the plt.fill_betweenx() command that illustrates the max violin. Default = {‘facecolor’:’black’, ‘edgecolor’:’black’}.

max_draw_summary_stat_kwargs : dict, optional

Keyword arguments passed to the plt.plot() command that illustrates the max violin summary statistic. Default = {‘color’:’gray’}.

draw_max_line : bool, optional

Flag specifying to illustrate a line from the max violin summary statistic across the plot.

draw_max_line_kwargs : dict, optional

Keyword arguments passed to the plt.plot() command that illustrates the max violin line. Default = {‘color’:’gray’, ‘linestyle’:’–’, ‘zorder’:-2}.

max_tick_label : str, optional

Label of max violin tick. Default=’Max’.

draw_model_kwargs : dict, optional

Keyword arguments passed to the plt.plot() command that illustrates the model. Default = {‘color’:’gray’, ‘zorder’:-1, ‘solid_capstyle’:’butt’}.

draw_log_zero_divider : bool, optional

Flag specifying to illustrate a line separating the position=0 violin from the data violins if xscale is log.

draw_log_zero_divider_kwargs : dict, optional

Keyword arguments passed to the plt.axvline() command that illustrates the position=0 violin divider. Default = {‘color’:’gray’, ‘linestyle’:’:’}.

draw_minmax_divider : bool, optional

Flag specifying to illustrate a vertical line separating the min and max violins from other violins.

draw_minmax_divider_kwargs : dict, optional

Keyword arguments passed to the plt.axvline() command that illustrates the min/max divider. Default = {‘color’:’gray’, ‘linestyle’:’-‘}.

xlabel : str, optional

Label to use on the x-axis.

ylabel : str, optional

Label to use on the y-axis. If None, channel name will be used if possible (extracted from the last data object).

title : str, optional

Plot title.