FlowCytometryTools.FCMeasurement.plot

FCMeasurement.plot(channel_names, kind='histogram', gates=None, gate_colors=None, gate_lw=1, **kwargs)[source]

Plot the flow cytometry data associated with the sample on the current axis.

To produce the plot, follow up with a call to matplotlib’s show() function.

channel_names : [str | iterable of str]

The name (or names) of the channels to plot. When one channel is specified, then a 1d histogram is plotted.

kind : [‘scatter’ | ‘histogram’]
Specifies the kind of plot to use for plotting the data (only applies to 2D plots).
autolabel : [False | True]
If True the x and y axes are labeled automatically.
colorbar : [False | True]
Adds a colorbar. Only relevant when plotting a 2d histogram.
xlabel_kwargs : dict
kwargs to be passed to the xlabel() command
ylabel_kwargs : dict
kwargs to be passed to the ylabel() command
bins : int | ndarray | [ndarray]

specifies how to bin histograms.

  • int : number of bins (autopilot!)
  • ndarray : for 1d histograms, e.g., linspace(-1000, 10000, 100)
  • [ndarray] : for 2d histograms, e.g., [linspace(-1000, 10000, 100), linspace(-1000, 10000, 100)]

CAUTION when bins=int, the bin locations are determined automatically based on the data. This means that the bins can have different widths, depending on the range of the data. When plotting using FCCollection (FCPlate), the bin locations are set according to minimum and maximum values of data from across all the FCMeasurements. If this is confusing for you, just specify the bin locations explicitely.

gates : [None | Gate | iterable of Gate]

Gate should be in [ThresholdGate | IntervalGate | QuadGate | PolyGate | CompositeGate]

.

When supplied, the gates are drawn on the plot. The gates are applied by default.

ax : [None | ax]

Specifies which axis to plot on. If None, will plot on the current axis.

gates : [None, Gate, list of Gate]
Gate must be of type [ThresholdGate | IntervalGate | QuadGate | PolyGate | CompositeGate]
.
gate_lw: float | iterable
line width to use when drawing gates if float, uses the same line width for all gates if iterable, then cycles between the values
kwargs : dict
Additional keyword arguments to be passed to graph.plotFCM

None : if no data is present plot_output : output of plot command used to draw (e.g., output of hist)

>>> sample.plot('Y2-A', bins=100, alpha=0.7, color='green', normed=1) # 1d histogram
>>> sample.plot(['B1-A', 'Y2-A'], cmap=cm.Oranges, colorbar=False) # 2d histogram