I am aiming at including a knitr plot in LyX that I can cross-reference in my document. I:
- Inserted a float image.
- Added a caption and a label.
- Inserted a ERT instead of an image in the float image.
An image of what I did is here:
I checked here at SO similar questions and nobody did what I've done so here I ask:
- Is there a simpler way to do what I am doing?
- How can I center the knitr image?
The code for my image is:
<<echo=FALSE>>=
dat <- data.frame(x=rnorm(100), y1=rnorm(100)-1, y2=rnorm(100), y3=rnorm(100)+1)
windows()
plot(y1 ~ x, data=dat, type='n', axes=FALSE, xlab="", ylab="")
text(dat$x,dat$y1,label=round(runif(100,0,100),0),col='blue', cex = abs(rnorm(100,0,1)))
text(dat$x,dat$y2,label=round(runif(100,0,100),0),col='purple', cex = abs(rnorm(100,0,1)))
text(dat$x,dat$y3,label=round(runif(100,0,100),0),col='red', cex = abs(rnorm(100,0,1)))
@
Thanks for looking into this. Your time is appreciated.