Re: [R] Sweave: controlling pointsize (pdf)

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Fri, 27 Jun 2008 07:32:52 -0400

On 27/06/2008 7:12 AM, Lauri Nikkinen wrote: > pdf.options() seems to be a new function (from 2.7.0), so I quess I'll > have to upgrade or write my own hook function for Sweave. Thanks.

I'd recommend upgrading. I think it would be difficult to do this with a hook function: you'd basically need to close the pdf file that Sweave opened, and reopen it with new args --- but I don't think it's easy for you to determine the filename that Sweave would have used. You probably need to look at sys.frame(-2)$chunkprefix or something equally ugly.

Duncan Murdoch

> 
> Best
> Lauri
> 
> 2008/6/27, Duncan Murdoch <murdoch_at_stats.uwo.ca>:
>> On 27/06/2008 6:23 AM, Lauri Nikkinen wrote:

>>> I'm working with Windows XP and R 2.6.0
>>>
>>>> R.Version()
>>>>
>>> $platform
>>> [1] "i386-pc-mingw32"
>>>
>>> -Lauri
>>>
>>> 2008/6/27, Lauri Nikkinen <lauri.nikkinen_at_iki.fi>:
>>>
>>>> Hello,
>>>>
>>>> Is there a way to control pointsize of pdf:s produced by Sweave? I
>>>> would like to have the same pointsize from (not a working example)
>>>>
>> You could use a pdf.options() call in an early chunk in the file, and it
>> will apply to subsequent chunks.
>>
>> For some other cases you might want code to be executed before every figure;
>> that could be put in a hook function (as described in ?Sweave, and in the
>> Sweave manual).
>>
>> Duncan Murdoch
>>

>>>> pdf(file="C:/temp/example.pdf", width=7, height=7, bg="white",
>> pointsize=10)

>>>> plot(1:10)
>>>> etc..
>>>> dev.off()
>>>>
>>>> as
>>>>
>>>> \documentclass[a4paper]{article}
>>>> \usepackage[latin1]{inputenc}
>>>> \usepackage[finnish]{babel}
>>>> \usepackage[T1]{fontenc}
>>>>
>> \usepackage{C:/progra\string~1/R/R-26\string~1.0/share/texmf/Sweave}

>>>> <<fig=TRUE, width=7, height=7>>=
>>>> plot(1:10)
>>>> etc..
>>>> @
>>>>
>>>> \end{document}
>>>>
>>>> Regards
>>>> Lauri
>>>>
>>>>
>>> ______________________________________________
>>> R-help_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html

>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
> 
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 27 Jun 2008 - 11:37:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 27 Jun 2008 - 12:31:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive