DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

Cyto_gate_draw() overlay labeling and coloring #161

Closed kim619 closed 1 year ago

kim619 commented 1 year ago

Hi Dillon,

I am working on overlaying gated populations onto another using cyto_gate_draw() function, though it does not seems to show the overlay population legend nor I couldn't find the color changing command in the vignettes. I wonder if you can give me some insights on doing them.

For example, I want to compare the two channels' output in the same population: so I want to have the overlaying population to be slightly transparent so I can visualize the other population.

cyto_gate_draw(gs1,parent="R6 GFP+RFP Pi", alias = "R6 GFP+RFP Pi_GFPonly1", channels = c("FITC-H"), select="05-Well-A1.fcs", type="interval", gatingTemplate="GatingTemplate4.csv", plot=TRUE, axes_limits="data", popup=FALSE) legend_text=c("R6 GFP+RFP pi GFP only","R6 GFP+RFP pi RFP only"), overlay=c(R6_GFP_RFP_Pi_RFPonly))

Screen Shot 2022-09-07 at 15 30 45

Thanks in advance.

DillonHammill commented 1 year ago

Legends are turned off in cyto_gate_draw(). I would recommend supplying the colours for each layer manually through point_col so you can keep track of things. The parent is always at the back and overlay on top.

kim619 commented 1 year ago

I got the coloring scheme now, but I fail to turn on the legend.

Example:

`> cyto_gate_edit(gs1,parent="root",
+                alias = "R6 GFP+RFP Pi",
+                channels = c("FITC-H","PE-H"),
+                select="05-Well-A1.fcs",
+                type="rectangle",
+                legend=TRUE,
+                gatingTemplate="GatingTemplate4.csv",
+                plot=TRUE,
+                axes_limits="data",
+                popup=FALSE)
Error in cyto_plot.flowFrame(fr_list[[y]][[1]], channels = channels, overlay = fr_list[[y]][seq_along(fr_list[[y]])[-1]],  : 
  formal argument "legend" matched by multiple actual arguments`
DillonHammill commented 1 year ago

You can't use the legend, it is turned off internally.

kim619 commented 1 year ago

Oh I see, so from the main page of the cytoexploreR package: I saw this gating scheme with the color legend on the side, is it manually added without R?

Screen Shot 2022-09-07 at 17 01 19
DillonHammill commented 1 year ago

Those are separate functions, cyto_gate_draw() is purely there to allow you to draw the gates. For more sophisticated visualisations look at cyto_plot() and cyto_plot_gating_scheme() as depicted above.

https://dillonhammill.github.io/CytoExploreR/articles/CytoExploreR-Visualisations.html

kim619 commented 1 year ago

Sounds good, thanks as always!