emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] question about R graphics and latex export


From: Andreas Leha
Subject: [Orgmode] question about R graphics and latex export
Date: Thu, 17 Feb 2011 14:52:45 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Iceowl/1.0b1 Icedove/3.0.11

Hi all,

I usually produce tikz graphics in R which produce great results in
latex export (and I am able to handle them....).
Now I have some plots too big to handle with tikz, so I go for pdf.

I have a question (example below):
There is one piece of code to produce several plots according to some
(only one in the example) parameters.  Now with pdf I have to produce a
different pdf file for each parameter (combination).
My question is:  Can I use Org variable and #+call: constructs to do that?

Thanks in advance!
- Andreas

PS: This is my sample:
=============================
#+TITLE:    Test Plots

* Test

** The plotting code
   This code takes the parameter =sd=
   #+srcname: plot_code
   #+begin_src R :session :exports code :eval never :var sd
     plot(x=rnorm(100, sd=sd),
          y=rnorm(100, sd=sd))
   #+end_src

** Set the parameter in =R= (working)
   When setting the parameter in =R= I need an "indirect" code block:
   #+srcname: plot_sd_1
   #+begin_src R :session :noweb tangle :file plotone.pdf :exports
results :results graphics silent :width 8 :height 4
     sd <- 1
   
     <<plot_code>>
   #+end_src

   Now I can include this nicely in latex: See figure \ref{fig:test}
    #+begin_src latex :noweb yes
      \begin{figure}[htb!]
        \centering
        \includegraphics[width=5in]{<<plot_sd_1()>>}
        \caption[Test]{Test 1}
        \label{fig:test}
      \end{figure}
    #+end_src


** Set the parameter in Org (How to do)
   The following does not work.  Is this somehow possible?  Would be
   much nicer than setting the parameters in R.
#  #+call: plot_code(sd=1) :session :file plotthree.pdf :exports results
:results graphics :width 8 :height 4
=============================


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]