Quantile error in make.colour.plot()
jamesboot opened this issue · 4 comments
Hello,
I'd like to fix the range of my colour scale on some UMAP plots - I.e. plot markers across the same scale, if possible. To do so I tried setting the col.max.threshold option in the function:
I've got a for loop to go through and plot for each of my markers in the panel (still get the error if I do the same command outside of the for loop):
for (x in colnames(fcs_dat_sub)) {
make.colour.plot(
cyt,
"tSNE_X",
"tSNE_Y",
col.axis = x,
col.type = 'continuous',
dot.size = 0.2,
title = gsub("_.*", "", x),
save.to.disk = F
)
ggsave(paste0(treatment, '_', x, '.png'))
}
However I get the following error:
Error in quantile.default(align.col.by[[col.axis]], probs = c(col.max.threshold), :
'probs' outside [0,1]
I've got a feeling I'm probably using the col.max.threshold incorrectly - is there a way to fix the scale of the colour axis - e.g. plot all marker's on a scale of 0-4 etc. ?
@jamesboot does it work on all the possible column names? It might happen if there is a column that is actually stored as characters or something similar, the 'continuous' setting might get confused...
Thanks @tomashhurst for the reply. Unfortunately it is any of the marker columns that returns the error. I can plot the marker expression no problem when I don't specify a min or max threshold, but then each marker is on it's own scale, it would be great to have a consistent scale across markers.
A bit more playing around and I've found that as long as I set the min and max threshold values between 0 and 1 then the plot works. But that doesn't fix my issue of having all the markers on the same scale.
Any ideas?
Found a work around. As I suspected I was using the col.max.threshold incorrectly. Instead I made a new data table with the column names matching the column names of the actual data object. Then I just put 2 values in each column - the minimum I wanted the scale to be and the maximum - use the same values across all markers if you want them consistent. I then specified this table in the align.col.by argument.
Cheers
@jamesboot clever work around, I'll have to put that in the function description as a tip in the future