如何填充geom_pointrange()后面的ggplot区域?

如何填充geom_pointrange()后面的ggplot区域?,r,ggplot2,tidyverse,R,Ggplot2,Tidyverse,为什么我在尝试填充其他几何图形后面的区域时会出现以下错误 库(magrittr) 图书馆(GG2) 图书馆(GGSTANTE) #> #>附加程序包:“GGSTANTE” #>以下对象被“package:ggplot2”屏蔽: #> #>geom_errorbarh,GeomErrorbarh 我的_df% ggplot()+ geom_rect(数据=rect1,aes(xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax), alpha=1,fill=“灰色70


为什么我在尝试填充其他几何图形后面的区域时会出现以下错误

库(magrittr)
图书馆(GG2)
图书馆(GGSTANTE)
#> 
#>附加程序包:“GGSTANTE”
#>以下对象被“package:ggplot2”屏蔽:
#> 
#>geom_errorbarh,GeomErrorbarh
我的_df%
ggplot()+
geom_rect(数据=rect1,aes(xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax),
alpha=1,fill=“灰色70”)+
geom_pointrangeh(aes(y=组,x=统计,xmin=LL,xmax=UL))
#>错误:离散值提供给连续刻度

注:第一次使用软件包发布问题,所以:非常好

不要用管道插入
ggplot2
(永远,真的)并用
geom_blank()
“填充”刻度:


最好避免将
数据
也用作变量名。

我还想知道,为什么仅在这个例子中就应该避免管道插入
ggplot()
。管道填充主要的
数据
参数,并在更复杂的图中填充,这会使事情变得非常困难。我还解释了更多关于管道的“原子操作”理念,我说过,对于探索图,我使用管道,但对于“生产”工作流(即我在工作中使用的RMD),我从不使用管道进入ggplot2。
ggplot() +
  geom_blank(data=data, aes(stat, group)) +
  geom_rect(data=rect1, aes(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax),
            alpha=1, fill="grey70")+
  geom_pointrangeh(data=data, 
                   aes(y = group, x = stat, xmin = LL, xmax = UL, color = group))