emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Images from R in LaTeX and PDF
@ 2011-01-07 17:23 Ben Ward
  2011-01-07 18:30 ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Ward @ 2011-01-07 17:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi All,

I've been doing some work with babel and R to generate graphs that I've 
then been including useing attr latex.

But when I include images the always appear very very small, even when I 
mess about with the width settings of the attr latex line and remove the 
options for wrap and such.

Does anybody else use R with images and org, and could tell me how they 
handle including R graphics in their documents?

Thanks,
Ben. W

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Images from R in LaTeX and PDF
  2011-01-07 17:23 Images from R in LaTeX and PDF Ben Ward
@ 2011-01-07 18:30 ` Thomas S. Dye
  2011-01-07 19:37   ` Ben Ward
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2011-01-07 18:30 UTC (permalink / raw)
  To: Ben Ward; +Cc: emacs-orgmode

Aloha Ben,

Can you share an example that doesn't work for you?

All the best,
Tom

On Jan 7, 2011, at 7:23 AM, Ben Ward wrote:

> Hi All,
>
> I've been doing some work with babel and R to generate graphs that  
> I've then been including useing attr latex.
>
> But when I include images the always appear very very small, even  
> when I mess about with the width settings of the attr latex line and  
> remove the options for wrap and such.
>
> Does anybody else use R with images and org, and could tell me how  
> they handle including R graphics in their documents?
>
> Thanks,
> Ben. W
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Images from R in LaTeX and PDF
  2011-01-07 18:30 ` Thomas S. Dye
@ 2011-01-07 19:37   ` Ben Ward
  2011-01-07 19:45     ` Erik Iverson
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Ward @ 2011-01-07 19:37 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode


#+begin_src R :exports both
  full <- read.csv(file="~/Documents/BSc Biology/Third Year/BY6001-40 - 
Dissertation/Data and Analysis/Evolution Results.csv", head=T)
  library("lattice")
  ecoli = subset(full, Bacterium=="E.coli")
  edett = subset(ecoli, Cleaner=="Dettol")
  egarl = subset(ecoli, Cleaner=="Garlic")
MIC.mod = lm(MIC. ~ 1+Challenge*Cleaner*Replicate, data=ecoli)
#+end_src

#+begin_src R :file fig1.pdf
  xyplot( MIC.+fitted(MIC.mod) ~ Challenge, data=ecoli, 
xlab="Challenge", ylab="MIC %", auto.key=TRUE)
#+end_src

#+attr_latex: width=0.6\textwidth wrap placement={h}{0.4\textwidth}
#+label: fig:one
#+caption: Linar Plot of real data and fitted model values
#+results: fig1
[[file:fig1.pdf]]

In the case of this code, actually altering size works, but it keeps 
putting the image at the end of my document. Then other images, placed 
with pretty much the same code, give or take for filenames and such, 
won't increace in size, but will alter their movement.
I'm wondering if using pure latex for my images would be an easier solution.

Cheers,
Ben.


On 07/01/2011 18:30, Thomas S. Dye wrote:
> Aloha Ben,
>
> Can you share an example that doesn't work for you?
>
> All the best,
> Tom
>
> On Jan 7, 2011, at 7:23 AM, Ben Ward wrote:
>
>> Hi All,
>>
>> I've been doing some work with babel and R to generate graphs that 
>> I've then been including useing attr latex.
>>
>> But when I include images the always appear very very small, even 
>> when I mess about with the width settings of the attr latex line and 
>> remove the options for wrap and such.
>>
>> Does anybody else use R with images and org, and could tell me how 
>> they handle including R graphics in their documents?
>>
>> Thanks,
>> Ben. W
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Images from R in LaTeX and PDF
  2011-01-07 19:37   ` Ben Ward
@ 2011-01-07 19:45     ` Erik Iverson
  2011-01-07 19:50       ` Ben Ward
  0 siblings, 1 reply; 6+ messages in thread
From: Erik Iverson @ 2011-01-07 19:45 UTC (permalink / raw)
  To: Ben Ward; +Cc: emacs-orgmode

And what version of org are you using?

Ben Ward wrote:
> 
> #+begin_src R :exports both
>  full <- read.csv(file="~/Documents/BSc Biology/Third Year/BY6001-40 - 
> Dissertation/Data and Analysis/Evolution Results.csv", head=T)
>  library("lattice")
>  ecoli = subset(full, Bacterium=="E.coli")
>  edett = subset(ecoli, Cleaner=="Dettol")
>  egarl = subset(ecoli, Cleaner=="Garlic")
> MIC.mod = lm(MIC. ~ 1+Challenge*Cleaner*Replicate, data=ecoli)
> #+end_src
> 
> #+begin_src R :file fig1.pdf
>  xyplot( MIC.+fitted(MIC.mod) ~ Challenge, data=ecoli, xlab="Challenge", 
> ylab="MIC %", auto.key=TRUE)
> #+end_src
> 
> #+attr_latex: width=0.6\textwidth wrap placement={h}{0.4\textwidth}
> #+label: fig:one
> #+caption: Linar Plot of real data and fitted model values
> #+results: fig1
> [[file:fig1.pdf]]
> 
> In the case of this code, actually altering size works, but it keeps 
> putting the image at the end of my document. Then other images, placed 
> with pretty much the same code, give or take for filenames and such, 
> won't increace in size, but will alter their movement.
> I'm wondering if using pure latex for my images would be an easier 
> solution.
> 
> Cheers,
> Ben.
> 
> 
> On 07/01/2011 18:30, Thomas S. Dye wrote:
>> Aloha Ben,
>>
>> Can you share an example that doesn't work for you?
>>
>> All the best,
>> Tom
>>
>> On Jan 7, 2011, at 7:23 AM, Ben Ward wrote:
>>
>>> Hi All,
>>>
>>> I've been doing some work with babel and R to generate graphs that 
>>> I've then been including useing attr latex.
>>>
>>> But when I include images the always appear very very small, even 
>>> when I mess about with the width settings of the attr latex line and 
>>> remove the options for wrap and such.
>>>
>>> Does anybody else use R with images and org, and could tell me how 
>>> they handle including R graphics in their documents?
>>>
>>> Thanks,
>>> Ben. W
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>>
>>
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Images from R in LaTeX and PDF
  2011-01-07 19:45     ` Erik Iverson
@ 2011-01-07 19:50       ` Ben Ward
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Ward @ 2011-01-07 19:50 UTC (permalink / raw)
  To: Erik Iverson; +Cc: emacs-orgmode

I'm using 7.4, which I think (unless a new versions recently arisen), 
the latest one, as it was recommended for interacting with R through babel.

Thanks,
Ben W.
On 07/01/2011 19:45, Erik Iverson wrote:
> And what version of org are you using?
>
> Ben Ward wrote:
>>
>> #+begin_src R :exports both
>>  full <- read.csv(file="~/Documents/BSc Biology/Third Year/BY6001-40 
>> - Dissertation/Data and Analysis/Evolution Results.csv", head=T)
>>  library("lattice")
>>  ecoli = subset(full, Bacterium=="E.coli")
>>  edett = subset(ecoli, Cleaner=="Dettol")
>>  egarl = subset(ecoli, Cleaner=="Garlic")
>> MIC.mod = lm(MIC. ~ 1+Challenge*Cleaner*Replicate, data=ecoli)
>> #+end_src
>>
>> #+begin_src R :file fig1.pdf
>>  xyplot( MIC.+fitted(MIC.mod) ~ Challenge, data=ecoli, 
>> xlab="Challenge", ylab="MIC %", auto.key=TRUE)
>> #+end_src
>>
>> #+attr_latex: width=0.6\textwidth wrap placement={h}{0.4\textwidth}
>> #+label: fig:one
>> #+caption: Linar Plot of real data and fitted model values
>> #+results: fig1
>> [[file:fig1.pdf]]
>>
>> In the case of this code, actually altering size works, but it keeps 
>> putting the image at the end of my document. Then other images, 
>> placed with pretty much the same code, give or take for filenames and 
>> such, won't increace in size, but will alter their movement.
>> I'm wondering if using pure latex for my images would be an easier 
>> solution.
>>
>> Cheers,
>> Ben.
>>
>>
>> On 07/01/2011 18:30, Thomas S. Dye wrote:
>>> Aloha Ben,
>>>
>>> Can you share an example that doesn't work for you?
>>>
>>> All the best,
>>> Tom
>>>
>>> On Jan 7, 2011, at 7:23 AM, Ben Ward wrote:
>>>
>>>> Hi All,
>>>>
>>>> I've been doing some work with babel and R to generate graphs that 
>>>> I've then been including useing attr latex.
>>>>
>>>> But when I include images the always appear very very small, even 
>>>> when I mess about with the width settings of the attr latex line 
>>>> and remove the options for wrap and such.
>>>>
>>>> Does anybody else use R with images and org, and could tell me how 
>>>> they handle including R graphics in their documents?
>>>>
>>>> Thanks,
>>>> Ben. W
>>>>
>>>> _______________________________________________
>>>> Emacs-orgmode mailing list
>>>> Please use `Reply All' to send replies to the list.
>>>> Emacs-orgmode@gnu.org
>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Images from R in LaTeX and PDF
@ 2011-01-08 12:28 Dan Davison
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Davison @ 2011-01-08 12:28 UTC (permalink / raw)
  To: benjamin.ward; +Cc: emacs-orgmode

Ben Ward <benjamin.ward@bathspa.org> writes:

> #+begin_src R :exports both
>   full <- read.csv(file="~/Documents/BSc Biology/Third Year/BY6001-40 - 
> Dissertation/Data and Analysis/Evolution Results.csv", head=T)
>   library("lattice")
>   ecoli = subset(full, Bacterium=="E.coli")
>   edett = subset(ecoli, Cleaner=="Dettol")
>   egarl = subset(ecoli, Cleaner=="Garlic")
> MIC.mod = lm(MIC. ~ 1+Challenge*Cleaner*Replicate, data=ecoli)
> #+end_src

Hi Ben,

Use the :width and :height header args to alter the dimensions of the
graphics. The arguments go straight through to the R device, so if you
are plotting to pdf they will be interpreted as inches (whereas they
will be pixels for png, jpeg etc).

With current Org, you will also need :results graphics in order to tell
R to send graphics to the designated file.

In addition, with lattice graphics, unless you are using :session, I
believe you will need :results output (so :results output graphics).

Do get back to us with any problems. There are several people who
routinely use R to include graphics in Org documents.

Dan

p.s. Request to everyone: can we try as much as possible to use
reproducible examples on-list?  I.e. toy examples that anyone can
execute, instead of real examples that rely on datasets that not
everyone has access to.

> #+begin_src R :file fig1.pdf
>   xyplot( MIC.+fitted(MIC.mod) ~ Challenge, data=ecoli, 
> xlab="Challenge", ylab="MIC %", auto.key=TRUE)
> #+end_src
>
> #+attr_latex: width=0.6\textwidth wrap placement={h}{0.4\textwidth}
> #+label: fig:one
> #+caption: Linar Plot of real data and fitted model values
> #+results: fig1
> [[file:fig1.pdf]]
>
> In the case of this code, actually altering size works, but it keeps 
> putting the image at the end of my document. Then other images, placed 
> with pretty much the same code, give or take for filenames and such, 
> won't increace in size, but will alter their movement.
> I'm wondering if using pure latex for my images would be an easier solution.
>
> Cheers,
> Ben.
>
>
> On 07/01/2011 18:30, Thomas S. Dye wrote:
>> Aloha Ben,
>>
>> Can you share an example that doesn't work for you?
>>
>> All the best,
>> Tom
>>
>> On Jan 7, 2011, at 7:23 AM, Ben Ward wrote:
>>
>>> Hi All,
>>>
>>> I've been doing some work with babel and R to generate graphs that 
>>> I've then been including useing attr latex.
>>>
>>> But when I include images the always appear very very small, even 
>>> when I mess about with the width settings of the attr latex line and 
>>> remove the options for wrap and such.
>>>
>>> Does anybody else use R with images and org, and could tell me how 
>>> they handle including R graphics in their documents?
>>>
>>> Thanks,
>>> Ben. W
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>>
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-08 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07 17:23 Images from R in LaTeX and PDF Ben Ward
2011-01-07 18:30 ` Thomas S. Dye
2011-01-07 19:37   ` Ben Ward
2011-01-07 19:45     ` Erik Iverson
2011-01-07 19:50       ` Ben Ward
  -- strict thread matches above, loose matches on Subject: below --
2011-01-08 12:28 Dan Davison

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).