Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggcyto fill and legend behavior dysfunctional #85

Open
rwbaer opened this issue Mar 30, 2022 · 0 comments
Open

ggcyto fill and legend behavior dysfunctional #85

rwbaer opened this issue Mar 30, 2022 · 0 comments

Comments

@rwbaer
Copy link

rwbaer commented Mar 30, 2022

@jacobpwagner
For reference to apparently a similar problem, see your .md file where it is claimed fills will appear but they do not.
See figures 5th & 6th figure at the link below:
[(https://github.com/RGLab/ggcyto/blob/master/vignettes/ggcyto.flowSet.md)]

In creating ggcyto figure, certain forms of faceting produces plots that are expected to have a legend but do not produce one. Further, when using geom_gate() on a 1D figure, The fill on the figure disappears.

Experimentation (well the experimentation failed and serendipity actually was key :-) shows that the problem(s) can be worked around by adding a theme(complete = TRUE) if that helps to figure out the root problem.

Here is a complete example. This may be related to the marginally reproducible issue #84, but I have not yet had a chance to do any complete testing.

Here is a reproducible example that also demonstrates the workaround:

# Legend and fill issues with ggcyto
library(openCyto)
library(ggcyto)
# A reproductible test gating set
data(GvHD)
fs <- GvHD[subset(pData(GvHD), Patient %in%5:7 & Visit %in% c(5:6))[["name"]]]

# transform
tf <- transformList(colnames(fs[[1]])[3:6], asinh, transformationId="asinh")
fs_trans<-transform(fs,tf)
gs <- GatingSet(fs_trans)

# Add a gate
chnl <- "FL1-H"
minden <- openCyto:::.mindensity(fs[[1]], channels = chnl)

ggplot(gs, subset = "root", aes(x = `FL1-H`, fill = name)) + geom_density(alpha = 0.2)

# Note that the expected legend is missing
p <- ggcyto(gs, aes(x = `FL1-H`), subset = "root") + 
  geom_density(aes(fill = Visit), alpha = 0.1) +
  facet_wrap(NULL)
p 

# Add a gate and the fill disappears too
p+ geom_gate(minden)

# The workaround is to add a complete theme
# The fill and missing legend return
p + theme(complete = TRUE)
p+ theme_gray()


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant