Spectre provides functions that enable quick and easy plotting of cellular data. These are facilitated within two key functions:
- make.colour.plot will save a dot plot with an 'X' and 'Y' axis. If no colour axis (col.axis) is specified, the data points will be coloured by density. If you specify another column as col.axis, then each point will be coloured using a continuous colour scheme (e.g. for marker expression) or a factor colour scheme (e.g. for sample name, group name, cluster etc).
- make.multi.plot will enable the generation of multiple plots with the same X and Y parameters in a single image. This can be used to plot multiple marker expression patterns, divide up the data by some factor, or both.
Each of these will display and save a .png of the specified dataset.
Review column names
We can create an X-Y colour plot using any columns in the dataset. First, let's see the column names for our data.
A basic X-Y plot where each dot point is coloured by the relative plot density. Note: the plots that colour cells by density take longer to create than other types of colour plots.
A basic X-Y plot where each dot point is coloured by some column. In this case, a continuous variable (such as a cellular marker).
Similar to the colour plot above, but coloured by some factor (e.g. Group).
Factor plot with labels
Similar to the factor plot above, but coloured by some factor (e.g. Cluster) where the of cells belonging to that factor are labelled.
Provide the function with a vector of column names to colour the plots by, and it will create one plot entry, and save it as a single image.
Multi plot + density
Same as the multi plot above, but adding a density plot at the end. Note: density calculations will mean the function runtime will be longer, compared to the same not including a density plot.
Multi plot – divided by the values in some column
Similar to the plots above, but done in repeating fashion, dividing the data by the values in a specified column (e.g. in this case, by group)
Coloured hex plot
To help avoid overplotting, cells can be 'binned' into hexagons on the colour plot, where each hexagon can be coloured by the average expression of the cells captured. This addition was implemented by Givanna Putri, and was inspired by the Schex package from Saskia Freytag.