Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 为什么geom_括号不允许我绘制括号?_R_Ggplot2 - Fatal编程技术网

R 为什么geom_括号不允许我绘制括号?

R 为什么geom_括号不允许我绘制括号?,r,ggplot2,R,Ggplot2,我想使用geom_括号为我的前两组国家(英国和法国)添加一个括号。我使用以下代码,它绘制了三个估计值: library(ggpubr) library(ggplot2) df %>% ggplot(aes(estimate, cntry)) + geom_point() 但是,每当我添加下面的geom_括号时,我都会得到一个错误。我试着用不同的方法来解决这个问题,但它仍然不起作用。有人能告诉我我做错了什么吗 df %>% ggplot(ae

我想使用
geom_括号
为我的前两组国家(英国和法国)添加一个括号。我使用以下代码,它绘制了三个估计值:

library(ggpubr)
library(ggplot2)

    df %>%
      ggplot(aes(estimate, cntry)) + 
      geom_point() 
但是,每当我添加下面的
geom_括号时,我都会得到一个错误。我试着用不同的方法来解决这个问题,但它仍然不起作用。有人能告诉我我做错了什么吗

df %>%
  ggplot(aes(estimate, cntry)) + 
  geom_point() +
  geom_bracket(ymin = "UK", ymax = "FR", x.position = -.75, label.size = 7,
               label = "group 1")
以下是一个可复制的示例:

structure(list(cntry = structure(1:3, .Label = c("BE", "FR", 
"UK"), class = "factor"), estimate = c(-0.748, 0.436, 
-0.640)), row.names = c(NA, -3L), groups = structure(list(
    cntry = structure(1:3, .Label = c("BE", "FR", "UK"), class = "factor"), 
    .rows = structure(list(1L, 2L, 3L), ptype = integer(0), class = c("vctrs_list_of", 
    "vctrs_vctr", "list"))), row.names = c(NA, 3L), class = c("tbl_df", 
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"))

您好,我实际上不知道如何制作竖括号,但问题是,ymin、ymax和x.position不是geom_括号()的参数“一个错误”。确切的错误文本是什么?@Bastien我很惊讶没有,因为我将此代码用于另一个脚本,它工作得非常好:geom_括号(xmin=2008.5,xmax=2011,x.position=85,label.size=7,label=“Group 1”)所以有xmin和xmax,但没有我以前不知道的ymin和ymax。@masher这里是错误:data.frame中的错误(label=label,y.position=y.position,xmin=xmin,:参数表示不同的行数:1,0