[R] Scaling Lattice Graphics for tikzDevice

Deepayan Sarkar deepayan.sarkar at gmail.com
Sun Feb 20 13:27:28 CET 2011


On Sun, Feb 20, 2011 at 5:23 AM, Elliot Joel Bernstein
<elliot.bernstein at fdopartners.com> wrote:
>
> On Feb 18, 2011 11:02 PM, "Deepayan Sarkar" <deepayan.sarkar at gmail.com>
> wrote:
>>
>> On Fri, Feb 18, 2011 at 11:04 PM, Elliot Joel Bernstein
>> <elliot.bernstein at fdopartners.com> wrote:
>> > I'm trying to use lattice graphics to produce some small plots for
>> > inclusion in a LaTeX file. I want the LaTeX fonts to be used in the plots,
>> > but to be scaled down to match the size of the plot. I have written the
>> > following code to apply a scaling factor to all the "cex" and "padding"
>> > entries in the trellis parameters, but there is still a large white space
>> > between the key and the top of the plot area. Does anyone know how I can get
>> > rid of that (or if I'm going about this all wrong and there's a much cleaner
>> > way)?
>> >
>> > ## ------ ##
>> > ## test.R ##
>> > ## ------ ##
>> >
>> > require(tikzDevice)
>>
>> I have not (yet) used tikzDevice, so don't know what impact it will
>> have, but in my experience with pdf(), it's usually more effective to
>> create a larger file and then scale it when including it in the .tex
>> file.
>>
>> -Deepayan
>>

[...]

>
> Deepayan -
>
> Thank you for your reply. In the past I've generally done what you suggest,
> but I'm trying to use tikz so the graphics can inherit the fonts used in the
> LaTeX document. Is there a way to do that with the pdf device?

Probably not, but look at the ?cairo_pdf device. It can use locally
installed truetype fonts through fontconfig, and truetype versions of
computer modern are available (I knew the details once, but don't have
time to find them again right now).

Also look at http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html

-Deepayan



More information about the R-help mailing list