When plotting an XTS object without any custom par attributes, I get a margin within the plot box (or “plot area” going off of http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm):
(It is hard to see due to white on white, but there is another maybe 20px or so between plot box (the box with the solid black line) and the edge of the image).
How can I adjust the margin within the plot box?
You could fix this by setting
yaxs="i"in your call toplot()orplot.xts()yaxsandxaxsspecify the methods used to calculate the extent of the plotted axes.yaxs="r"(the default) is to extend the axis a bit beyond your minimum and maximum y-values.yaxs="i"plots axes that just cover the range of your data (or the supplied value ofylim) with no additional buffer.It’s not pretty, but this example will show you the difference:
If you want even finer control over the range plotted, you might want to use
yaxs="i"in combination withylim=extendrange(range(yvalues)).