cytoflow.views.base_views

class cytoflow.views.base_views.BaseView[source]

Bases: traits.has_traits.HasStrictTraits

The base class for facetted plotting.

xfacet, yfacet

Set to one of the conditions in the Experiment, and a new row or column of subplots will be added for every unique value of that condition.

Type:String
huefacet

Set to one of the conditions in the in the Experiment, and a new color will be added to the plot for every unique value of that condition.

Type:String
huescale

How should the color scale for huefacet be scaled?

Type:{‘linear’, ‘log’, ‘logicle’}
plot(experiment, data, **kwargs)[source]

Base function for facetted plotting

Parameters:
  • experiment (Experiment) – The Experiment to plot using this view.
  • title (str) – Set the plot title
  • xlabel, ylabel (str) – Set the X and Y axis labels
  • huelabel (str) – Set the label for the hue facet (in the legend)
  • legend (bool) – Plot a legend for the color or hue facet? Defaults to True.
  • sharex, sharey (bool) – If there are multiple subplots, should they share axes? Defaults to True.
  • height (float) – The height of each row in inches. Default = 3.0
  • aspect (float) – The aspect ratio of each subplot. Default = 1.5
  • col_wrap (int) – If xfacet is set and yfacet is not set, you can “wrap” the subplots around so that they form a multi-row grid by setting col_wrap to the number of columns you want.
  • sns_style ({“darkgrid”, “whitegrid”, “dark”, “white”, “ticks”}) – Which seaborn style to apply to the plot? Default is whitegrid.
  • sns_context ({“paper”, “notebook”, “talk”, “poster”}) – Which seaborn context to use? Controls the scaling of plot elements such as tick labels and the legend. Default is talk.
  • despine (Bool) – Remove the top and right axes from the plot? Default is True.
Other Parameters:
 
  • cmap (matplotlib colormap) – If plotting a huefacet with many values, use this color map instead of the default.
  • norm (matplotlib.colors.Normalize) – If plotting a huefacet with many values, use this object for color scale normalization.
class cytoflow.views.base_views.BaseDataView[source]

Bases: cytoflow.views.base_views.BaseView

The base class for data views (as opposed to statistics views).

plot(experiment, **kwargs)[source]

Plot some data from an experiment. This function takes care of checking for facet name validity and subsetting, then passes the underlying dataframe to BaseView.plot

Parameters:
  • min_quantile (float (>0.0 and <1.0, default = 0.001)) – Clip data that is less than this quantile.
  • max_quantile (float (>0.0 and <1.0, default = 1.00)) – Clip data that is greater than this quantile.
Other Parameters:
 
  • lim (Dict(Str : (float, float))) – Set the range of each channel’s axis. If unspecified, assume that the limits are the minimum and maximum of the clipped data. Required.
  • scale (Dict(Str : IScale)) – Scale the data on each axis. Required.
class cytoflow.views.base_views.Base1DView[source]

Bases: cytoflow.views.base_views.BaseDataView

A data view that plots data from a single channel.

channel

The channel to view

Type:Str
scale

The scale applied to the data before plotting it.

Type:{‘linear’, ‘log’, ‘logicle’}
plot(experiment, **kwargs)[source]
Parameters:
  • lim ((float, float)) – Set the range of the plot’s data axis.
  • orientation ({‘vertical’, ‘horizontal’})
class cytoflow.views.base_views.Base2DView[source]

Bases: cytoflow.views.base_views.BaseDataView

A data view that plots data from two channels.

xchannel, ychannel

The channels to view

Type:Str
xscale, yscale

The scales applied to the data before plotting it.

Type:{‘linear’, ‘log’, ‘logicle’} (default = ‘linear’)
xlim, ylim

Set the min and max limits of the plots’ x and y axes.

Type:(float, float)
plot(experiment, **kwargs)[source]
Parameters:xlim, ylim ((float, float)) – Set the range of the plot’s axis.
class cytoflow.views.base_views.BaseNDView[source]

Bases: cytoflow.views.base_views.BaseDataView

A data view that plots data from one or more channels.

channels

The channels to view

Type:List(Str)
scale

Re-scale the data in the specified channels before plotting. If a channel isn’t specified, assume that the scale is linear.

Type:Dict(Str : {“linear”, “logicle”, “log”})
plot(experiment, **kwargs)[source]
Parameters:lim (Dict(Str : (float, float))) – Set the range of each channel’s axis. If unspecified, assume that the limits are the minimum and maximum of the clipped data
class cytoflow.views.base_views.BaseStatisticsView[source]

Bases: cytoflow.views.base_views.BaseView

The base class for statisticxs views (as opposed to data views).

variable

The condition that varies when plotting this statistic: used for the x axis of line plots, the bar groups in bar plots, etc.

Type:str
subset

An expression that specifies the subset of the statistic to plot.

Type:str
enum_plots(experiment, data)[source]

Enumerate the named plots we can make from this set of statistics.

plot(experiment, data, plot_name=None, **kwargs)[source]

Plot some data from a statistic.

This function takes care of checking for facet name validity and subsetting, then passes the dataframe to BaseView.plot

class cytoflow.views.base_views.Base1DStatisticsView[source]

Bases: cytoflow.views.base_views.BaseStatisticsView

The base class for 1-dimensional statistic views – ie, the variable attribute is on the x axis, and the statistic value is on the y axis.

statistic

The name of the statistic to plot. Must be a key in the statistics attribute of the Experiment being plotted.

Type:(str, str)
error_statistic

The name of the statistic used to plot error bars. Must be a key in the statistics attribute of the Experiment being plotted.

Type:(str, str)
scale

The scale applied to the data before plotting it.

Type:{‘linear’, ‘log’, ‘logicle’}
REMOVED_ERROR = 'Statistics changed dramatically in 0.5; please see the documentation'
enum_plots(experiment)[source]

Enumerate the named plots we can make from this set of statistics.

plot(experiment, plot_name=None, **kwargs)[source]
Parameters:
  • orientation ({‘vertical’, ‘horizontal’})
  • lim ((float, float)) – Set the range of the plot’s axis.
class cytoflow.views.base_views.Base2DStatisticsView[source]

Bases: cytoflow.views.base_views.BaseStatisticsView

The base class for 2-dimensional statistic views – ie, the variable attribute varies independently, and the corresponding values from the x and y statistics are plotted on the x and y axes.

xstatistic, ystatistic

The name of the statistics to plot. Must be a keys in the statistics attribute of the Experiment being plotted.

Type:(str, str)
x_error_statistic, y_error_statistic

The name of the statistics used to plot error bars. Must be keys in the statistics attribute of the Experiment being plotted.

Type:(str, str)
xscale, yscale

The scales applied to the data before plotting it.

Type:{‘linear’, ‘log’, ‘logicle’}
STATS_REMOVED = '{} has been removed. Statistics changed dramatically in 0.5; please see the documentation.'
enum_plots(experiment)[source]

Enumerate the named plots we can make from this set of statistics.

plot(experiment, plot_name=None, **kwargs)[source]
Parameters:xlim, ylim ((float, float)) – Set the range of the plot’s axis.