How can I modify how bars are displayed on a R barplot
I would like to plot 2 graphs of the same time serie, the first one would represent value, the second frequency of the same variable.
date 1 2 3 4 5 6 7 ... value v1 v2 v3 v4 v5 v6 v7 ... freq f1 f2 f3 ...
The first graph is a usual plot, the second is a graphics::barplot, my problem is that I want the x-ticks to be on the same vertical line (after all it is the same date). It seems that barplot is centering the bars so any vertical line representing date is shifted (zoom on the graph bellow to see what I mean)
How can I arrange this ?
You could do it without using barplot(), but rather plot() with a different plot "type" argument. And do make sure that your x-axis values are the same.
An old example of mine is the Bollinger Bands plotting at the R Graph Gallery. It uses segments() for the volume bars.