Reputation: 73
I wanted a customized plot whose X-axis is the experiment number and there is a box plotted for every experiment. The height of the box is determined by two values (ymin and ymax) and the width of the box is same for all experiments.
I have tried to make such a plot using 4 geom_segment commands as follows
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 ))
where Exp=experiment number and width=1
Please find attached the plot. However I think There should be a better method than this.
Upvotes: 2
Views: 71