Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.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 创建散点图,其中符号高度/宽度由2个变量控制_R_Ggplot2 - Fatal编程技术网

R 创建散点图,其中符号高度/宽度由2个变量控制

R 创建散点图,其中符号高度/宽度由2个变量控制,r,ggplot2,R,Ggplot2,我对R非常陌生,我正试图在ggplot2中创建一个散点图,它影响一个散点图,其中每个符号的宽度和高度由两个变量控制。我已经想出了一个使用geom_errorbar和geo_errorbarh(下面的代码)的解决方案,它沿着我正在寻找的路线产生了一些东西,但我希望能够删除错误x/y交叉线,只为每个数据点留下一个框,我可以在其中着色(我只需要它们是一种颜色)。我正在谈论的这类事情的一个例子是: 我的数据的一个子集是(我希望我正确地使用了dput()): 我目前得到的代码是: ggplot(d

我对R非常陌生,我正试图在ggplot2中创建一个散点图,它影响一个散点图,其中每个符号的宽度和高度由两个变量控制。我已经想出了一个使用geom_errorbar和geo_errorbarh(下面的代码)的解决方案,它沿着我正在寻找的路线产生了一些东西,但我希望能够删除错误x/y交叉线,只为每个数据点留下一个框,我可以在其中着色(我只需要它们是一种颜色)。我正在谈论的这类事情的一个例子是:

我的数据的一个子集是(我希望我正确地使用了dput()):

我目前得到的代码是:

    ggplot(data, aes(x=Year, y=RSL)) + geom_errorbar(aes(ymin=minus_error, ymax=plus_error, width=total_Ageerror)) + geom_errorbarh(aes(xmax=plus_age, xmin=minus_age, height=total_RSLerror)) + theme_bw()

非常感谢你的期待。如果我需要发送任何其他信息或输入错误,请告诉我。

您可以使用
geom\u rect()
并使用
变量作为
max
min
坐标(将数据命名为
df
)来实现


您可以使用
geom_rect()
并使用
变量作为
max
min
坐标(将数据命名为
df


你绝对是个传奇人物,迪兹。这比我想实现的要容易得多。非常感谢你,你真是个传奇人物。这比我想实现的要容易得多。非常感谢。可能的副本可能的副本
    ggplot(data, aes(x=Year, y=RSL)) + geom_errorbar(aes(ymin=minus_error, ymax=plus_error, width=total_Ageerror)) + geom_errorbarh(aes(xmax=plus_age, xmin=minus_age, height=total_RSLerror)) + theme_bw()
ggplot(df,aes(xmin=minus_age,xmax=plus_age,ymin=minus_error,ymax=plus_error))+
  geom_rect(fill="green",color="black")