Question

I am writing up a short report in Lyx (2.0.6) and I have six chunks of R code (3.0.2) that each generate a plot (i.e., six plots). The problem is that the plots always shows up at the top of the page whereas I want the plots to always immediately follow the code that produced it. I have tried the chunk option fig.show="asis" and Documents -> Settings -> float placement -> here definitely, but neither seems to have any effect. Any suggestions?

Was it helpful?

Solution

After a bit of experimentation I found that I can get tables and figures generated with R/knitr to behave the way I want if I put the chunks in Lyx floats (Tables and Figures) rather than have knitr generate the floats. The xtable option float=FALSE was used.

OTHER TIPS

You could add fig.pos="H" to the knitr options, either for each chunk with a figure, or globally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top