I'm having success using ggcyto and the geom_gate function to show rectangle gates. However, when I follow the same approach to show a polygon gate, I get a warning message that I don't understand. The hex plot is made, but no gate lines are plotted. Are more arguments to geom_gate required when the gate is a polygon gate?
Here is the relevant section of my code:
sqrcut <- matrix(c(1.1,1.2,5,5, 0,1.7,2,0),ncol=2,nrow=4) colnames(sqrcut) <- c("FL03.A","FL17.A") polyGate <- polygonGate(filterId = "Expressing-Live-Gate", .gate = sqrcut) ggcyto(myFlowFrame, aes(x = "FL03.A", y = "FL17.A")) + geom_hex(bins = 96) + geom_gate(polyGate)
The error that's returned when I run it is this, I don't understand the reference to a group in this context. The hex plot is made, however.
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic? Warning messages: 1: Removed 1 rows containing missing values (geom_hex). 2: Removed 4 rows containing missing values (geom_path).
Oh my, yes that's all it is. I was thinking even if an edge was off scale the left-hand vertical line of the polygon would still be drawn and visible, but apparently that's not the case. The range of the data is slightly less that the ranges of some of the polygon vertices. Forcing xlim and ylim wider shows that the ploygon gate is drawn, and ensuring the gate vertices are within the data range behaves similarly.
Resulting image