我想要一个自定义图,其X轴是实验编号,每个实验都有一个框。盒子的高度由两个值(ymin和ymax)决定,盒子的宽度对于所有实验都是相同的。
我尝试使用4个geom_segment命令制作这样的情节,如下所示
geom_segment(aes(y = open, yend = open, x = Exp - width / 4, xend = Exp + width / 4 )) +
geom_segment(aes(y = close, yend = close, x = Exp - width / 4, xend = Exp + width / 4 )) +
geom_segment(aes(y = pmin(open,close), yend = pmax(open,close), x = Exp - width / 4, xend = Exp - width / 4 )) +
geom_segment(aes(y = pmin(open,close), yend = pmax(open,close), x = Exp + width / 4, xend = Exp + width / 4 ))
其中Exp =实验数和宽度= 1