RGLab / flowWorkspace

flowWorkspace
GNU Affero General Public License v3.0
44 stars 21 forks source link

Missing legend in plotGate figures #292

Open jmcelh opened 4 years ago

jmcelh commented 4 years ago

Dear Team, I have been implementing your lab's cytometry packages in R (which I must say have been excellent to use) and have noticed that when updating R/Rstudio, or making a fresh install on a new computer, the color scale legend for 'plotGate'-type scatter plots no longer appear alongside the plots (please see image in link 1 for an example of a plot and link 2 for the omitted feature). It seems to be a version-related issue. I am curious to know if this is a known problem and whether there is any way to bring the legend back in by explicitly calling it? I have been toying with '+scale_color_gradientn'-type commands but this does not seem to work with 'plotGate' (or 'ggcyto' commands).

Any ideas would be most appreciated.

Best wishes,

James

Link 1 Link 2

jacobpwagner commented 4 years ago

Hi @jmcelh , this is discussed in detail in https://github.com/RGLab/ggcyto/issues/32, but the legend was intentionally removed in https://github.com/RGLab/ggcyto/commit/7e369d396b7a456fbc70a15bb99a024df0c84f85 so as to not misrepresent the data after the change to subsampling events for efficiency of plotting.

jacobpwagner commented 4 years ago

After https://github.com/RGLab/ggcyto/commit/1fd4be72626eb3b2afbf42abf7e4e3703f03d726, you should be able to add the legend back in with legend(position = "right") (or whichever side you want it to be on). So like this (where g is the object resulting from your ggcyto or autoplot call):

g + legend(position = "right")

Please try installing from the github repo:

devtools::install_github("RGLab/ggcyto", ref = "trunk")

and seeing if that solves the problem.

jmcelh commented 4 years ago

Hi @jacobpwagner, Many thanks for your sterling support!

I downloaded the suggested version of ggcyto and after getting some other packages updated/on dev versions was able to get the desired result by using g + theme(legend.position='right') One thing I noticed, that I will post in the openCyto page, is that the plotGate command now generate empty plots though I was able to get the data plotted by invoking ggcyto instead of plotGate. Thanks again and best wishes, James

jmcelh commented 4 years ago

One thing I just noticed comparing sample plots made with and without sub-sampling is that sub-sampling can make quite a difference when plotting multiple samples against each other, in the examples below turning it off highlights some interesting differences between the samples for me (that are otherwise masked). Whilst this is probably obvious to the team, it may be something to highlight in the vignette (as an end-user I wasn't aware of the sub-sampling and its effect).

Best wishes,

James sub-sampling effect ggcyto

jacobpwagner commented 4 years ago

Hi @jmcelh , another user had mentioned the blank plotGate issue before in https://github.com/RGLab/CytoML/issues/70. I'll try to get to the bottom of it and reply in https://github.com/RGLab/openCyto/issues/203.

And I agree that it would be a good idea to highlight the subsampling more in the vignette. I'll get on that as well and leave this open until it's done.