Open hughjonesd opened 1 year ago
Example:
library(ggplot2) ggp <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, shape = Species)) ggp2 <- ggp + geom_point() from <- c(2.5, 3.0, 5.5, 6.0) to <- c(3.5, 4.5, 4.5, 5.5) ggp2 + xlim(2,5) + geom_magnify(aes(from = Species=="versicolor" & Sepal.Length < 6), to = c(4, 4.8, 5, 6))
This doesn't print a magnified inset, and gives a warning about dropped cases.
The failure is because xmin becomes NA in the data, which then leads all cases to be dropped as incomplete.
xmin
NA
Not sure why xmin is becoming NA. It's fine with xlim(1.9, 5) ; or with expand = 0.
xlim(1.9, 5)
expand = 0
StatMagnify unsurprisingly sets xmin to 1.94. Then some time before the geom, that 1.94 becomes NA in the data.
Example:
This doesn't print a magnified inset, and gives a warning about dropped cases.
The failure is because
xmin
becomesNA
in the data, which then leads all cases to be dropped as incomplete.Not sure why
xmin
is becomingNA
. It's fine withxlim(1.9, 5)
; or withexpand = 0
.