Closed friendly closed 9 years ago
You shouldn't need to use the last line, par(op)
, because knitr resets the par argument automatically after each chunk is complete. Also, echo
accepts negation indexing, so you can remove lines with the -
operator. So this would be a more robust approach:
<<echo=-1>>=
par(mar=c(4,4,1,1)+.1)
plot(...)
abiline()
Fixed many of these, but there are still some remaining usages of par(op) in Ch6, Ch7, Ch10, Ch11
I like to have graphs with tight bounding boxes, but in quite a few places, the graphs have excessively large figure margins, so I've used code like
I'd rather not show these setting lines in the text, and so I've sometimes used the chunk option
echo
If you see such lines appearing in the text, try to fix them. For graphs that don't obey par() settings, there is also the
crop
chunk option that invokespdfcrop
. However, that's expensive, in that it adds considerably to knit time. Probably should usecache=TRUE
here, or just cheat and useincludegraphics
on the cropped image file.