I was trying to plot something using facet_zoom() with xlim to specify the region and was getting "subscript too long..." error. I tried the vanilla example from the docs and I got the same error.
library(ggplot2)
library(ggforce)
theme_set(ggthemes::theme_base() + theme(plot.background = element_rect(color=NA)))
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(xlim = c(2, 4))
#> Warning in rep(colour, length.out = length(alpha)): 'x' is NULL so the result
#> will be NULL
#> Error in `[<-`(`*tmp*`, !is.na(alpha), 4, value = alpha[!is.na(alpha)]): (subscript) logical subscript too long
I knew that the vanilla example had to work, so I tried it using theme_gray() and it woks as expected.
# Works with theme gray()
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
theme_gray() +
facet_zoom(xlim = c(2, 4))
Same for theme_bw()
# Works with theme bw()
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
theme_bw() +
facet_zoom(xlim = c(2, 4))
Not sure this is a ggforce or ggthemes issue to be honest, so this might not be the best place to put it.
I was trying to plot something using
facet_zoom()
withxlim
to specify the region and was getting "subscript too long..." error. I tried the vanilla example from the docs and I got the same error.I knew that the vanilla example had to work, so I tried it using
theme_gray()
and it woks as expected.Same for
theme_bw()
Not sure this is a
ggforce
orggthemes
issue to be honest, so this might not be the best place to put it.Created on 2022-09-26 by the reprex package (v2.0.1)