在 ggplot2 中将 abline 添加到 facet_zoom

Add abline to facet_zoom in ggplot2

我有一个看起来像这样的数据集

data <- data.frame(x = log(runif(100, min = 1, max = 10)), 
                   y = log(runif(100,min = 1, max = 10)))

当我使用下面的代码绘图时出现错误 (Error in scale_index[[i]] : subscript out of bounds)

ggplot(data, aes(x = x, y = y))+
  geom_point()+
  facet_zoom(x = x >2 & x < 3, y = y >2 & y < 3)+
  geom_abline(intercept = 0, slope = 1, color="black", linetype="dashed", size=0.5)

在没有 abline 的情况下绘制它工作正常,但我真的想添加这个 abline(身份线)而不使用一些图像版本。

我想要的是:

我也不介意在主情节中出现这条线(在 facet_zoom 之外)。

这是我收到的错误消息(我使用的是 ggforce 0.3.3):

已解决。

显然是兼容性问题。我使用的是 ggplot2 v3.3.4。更新到 v3.3.5 解决了这个问题。