DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

Error in colorRampPalette(point_cols) : object 'point_cols' not found #110

Closed Biomiha closed 3 years ago

Biomiha commented 3 years ago

Hi @DillonHammill,

I've noticed that if I set a personalised theme for plotting in CytoExplorereR, i.e.:

# Viridis palettes
library(viridis)
viridis_pal <- viridis(10, option = "D")
plasma_pal <- viridis(10, option = "C")

# Remove overlapping colours
viridis_pal <- viridis_pal[-10]
plasma_pal <- plasma_pal[-c(1:4)]

# Combine palettes
custom_pal <- c(viridis_pal, rev(plasma_pal))

# Set custom theme
cyto_plot_theme(point_col_scale = custom_pal)

I get the following error if I want to plot the gating scheme with back_gate = TRUE:

Error in colorRampPalette(point_cols) : object 'point_cols' not found

No issues plotting this out if cyto_plot_theme is not set. I imagine there is a call to point_cols from cyto_plot_gating_scheme that gets overridden by the new theme.

Thanks.

DillonHammill commented 3 years ago

@Biomiha, looks like I assumed that users would not change the colour scale when setting back_gate = TRUE as the points in the base layer would be concealed by overlays (making the colour scale irrelevant). Nevertheless, I pushed a temporary fix to the master branch for you:

devtools::install_github("DillonHammill/CytoExploreR')
Biomiha commented 3 years ago

Thanks @DillonHammill. I think that's a reasonable assumption. What happened was that I set the theme at the beginning of the script to obviously include all subsequent plots and I plotted the gating scheme after I'd done all the gating. Thanks for the fix.