calour.plotting.plot_feature_matrix

calour.plotting.plot_feature_matrix(exp: calour.experiment.Experiment, fields, feature_ids, title_field=None, transform_x=None, transform_y=None, plot='scatter', ncols=5, nrows=None, size=2, aspect=1, **kwargs)[source]

This plots an array of scatter plots between each features against the specified sample metadata.

For each panel of scatter plot, the x-axis is the co-variates specified by sample metadata field; the y-axis is the feature abundance.

Note

This function is also available as a class method Experiment.plot_feature_matrix()

Parameters:
  • exp (Experiment) – Input experiment object.
  • fields (str) – the column in the sample metadata to plot against
  • feature_ids (list-like) – the IDs of features
  • transform_y (transform_x,) – the transformation for values on x- and y-axis
  • plot (str, {'scatter', 'box'}) – the plot type
  • nrows (ncols,) – plot nrows x ncols number of scatter plots. If nrows is None, then its value is determined automatically by the-number-features / ncols
  • size (numeric) – the height of each figure panel in inches
  • aspect (numeric) – Aspect ratio of each figure panel, so that aspect * size gives its width
  • kwargs (dict) – keyword arguments passing to either matplotlib.pyplot.boxplot() or matplotlib.pyplot.scatter(), depending on plot argument.
Returns:

Return type:

matplotlib.figure.Figure