Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-09 Thread Yihui Xie
Hi Francesco, This is an advanced topic in knitr; it is called a chunk hook: http://yihui.name/knitr/hooks Sorry for the confusion on the name "par"; you can call it anything, e.g. mypar knit_hooks$set(mypar = function(before, options, envir) { if (before) par(mar = c(4, 4, .1, .1)) }) opts_ch

Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-09 Thread Francesco Sarracino
Dear Yihui, thanks a lot for your kind reply. Your solution is very elegant and versatile. However, there is a point that is obscure to me and I didn't manage to fully understand them after looking at the Knitr manual and graphic manual. The issue concerns the hook: *knit_hooks$set(par = function

Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Yihui Xie
All you mentioned are possible; knitr has very comprehensive support to figures in LaTeX, and what you want in this case is subfigures (\usepackage{subfig}); here is an example: https://github.com/yihui/knitr-examples/blob/master/067-graphics-options.Rnw (search for 'fig.subcap' for the relevant ch

Re: [R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Ulises M. Alvarez
On 01/08/2013 04:17 AM, Francesco Sarracino wrote: Dear R helpers, I am using knitr to run analysis with R and edit my document with Latex. I am wondering whether there is a way to include 2 or more pictures per chunk and being able to refer them in the text independently and eventually whether

[R] how to label two figures in the same chunk independently with knitr

2013-01-08 Thread Francesco Sarracino
Dear R helpers, I am using knitr to run analysis with R and edit my document with Latex. I am wondering whether there is a way to include 2 or more pictures per chunk and being able to refer them in the text independently and eventually whether it is possible to give them different captions. Let m