You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally a use case arises where it is helpful to be able to plot gates using geom_gate without any underlying data present, just to visually inspect the gate definitions. However, this cannot be accomplished with the current ggcyto method framework without a bit of a hacky workaround. If you try providing a mapping without providing data (e.g. ggcyto(mapping=aes("FSC-H, "SSC-H")), the call ends up here because data=NULL:
stop("ggcyto doesn't know how to deal with data of class ", class(model), call.=FALSE)
}
One workaround is to just give the ggcyto call a dummy flowFrame to work with, but we can't expect users to know to do this:
library(flowCore)
library(flowWorkspace)
library(CytoML)
library(ggcyto)
ws <- open_flowjo_xml(system.file("extdata", "manual.xml", package="flowWorkspaceData"))
gs <- flowjo_to_gatingset(ws, name=2, execute=FALSE)
gate <- gh_pop_get_gate(gs[[1]], "singlets")
dummy <- matrix(as.numeric(c(0,0)), nrow = 1, ncol = 2) # Needs at least one row bc of some min/max calls...
gate_dims <- colnames(gate@boundaries)
colnames(dummy) <- gate_dims
fr <- flowFrame(dummy)
ggcyto(fr, aes_(gate_dims[[1]], gate_dims[[2]])) +
geom_gate(gate) +
ggcyto_par_set(limits=list(x=c(0,max(gate@boundaries[,1])), y=c(0,max(gate@boundaries[,2]))))
An easy first fix that would have minimal ramifications would be to make a function to wrap up similar logic to just plot a gate. Ideally, we could incorporate this in to the structure of the ggcyto call dispatch, but that requires more careful consideration.
The text was updated successfully, but these errors were encountered:
Occasionally a use case arises where it is helpful to be able to plot gates using
geom_gate
without any underlying data present, just to visually inspect the gate definitions. However, this cannot be accomplished with the currentggcyto
method framework without a bit of a hacky workaround. If you try providing a mapping without providing data (e.g.ggcyto(mapping=aes("FSC-H, "SSC-H")
), the call ends up here becausedata=NULL
:ggcyto/R/fortify_fs.R
Lines 27 to 30 in 5ced2c1
One workaround is to just give the
ggcyto
call a dummyflowFrame
to work with, but we can't expect users to know to do this:An easy first fix that would have minimal ramifications would be to make a function to wrap up similar logic to just plot a gate. Ideally, we could incorporate this in to the structure of the
ggcyto
call dispatch, but that requires more careful consideration.The text was updated successfully, but these errors were encountered: