yihui/knitr — Issue #157: A horizontal legend is plotted outside figure boundaries
Author: SeeLittle
Created: 2012-02-29 22:40:55+00:00
State: open

I've been running into some issues trying to plot a horizonal legend in a pdf (or any other device I tried). It is always plotted partially outside the plot. I don't have the same issue with writing directly to a pdf device. I have the feeling it might stem from the fact that the legend function takes the dimensions of the plot before knitr actually writes the plot to a device, and those dimensions are too small.

I uploaded a reproducible Rnw file to a git repo: https://github.com/SeeLittle/knitrTest/

I tested it with the latest knitr version. Please be aware that I'm just starting out in using your otherwise excellent package, so I might be making a very simple mistake.