Reputation: 356
I am aiming at including a knitr plot in LyX that I can cross-reference in my document. I:
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:
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.
Upvotes: 2
Views: 85
Reputation: 356
Alright, I figured out how to center the knitr image in a float image in LyX:
Click on top of the caption and then right click to get Paragraph Settings so that you can center the ERT before inserting the ERT.
You are done: the image is centered and it can be cross-referenced in your LyX file...
For the other question:
Perhaps there is but in LyX, by clicking on Help - Specific Manuals - Sweave, there is something similar to what I am doing as shown here:
So I guess we're done with this...
Upvotes: 1