Dear Charlie,

you are exactly right, I think the amount of rectangles creates the problem.


1. Was it the inclusion of one tikzDevice plot or a series of plots that
caused TeX to run out of memory?


It was a series of plots (also only one created with tikzdevice. Nevertheless, I created a standalone *.tex file with the following commands - and I still get the memory error. (See below)

sn <- seq(1,7,length=100)
sm <- seq(0,4,length=100)
f <- function(x,y) {5.64080973 + 0.12271038*x - 0.27725481 * y + 0.29281216*x*y}
z <- outer(sn,sm,f)

nrz <- nrow(z)
ncz <- ncol(z)
jet.colors <- colorRampPalette( c("yellow", "red") ) nbcol <- 100
color <- jet.colors(nbcol)
zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
facetcol <- cut(zfacet, nbcol)

CM <- Type1Font("CM",
                    c("cm-lgc/fonts/afm/public/cm-lgc/fcmr8a.afm",
                      "cm-lgc/fonts/afm/public/cm-lgc/fcmb8a.afm",
                      "cm-lgc/fonts/afm/public/cm-lgc/fcmri8a.afm",
                      "cm-lgc/fonts/afm/public/cm-lgc/fcmbi8a.afm",
"cmsyase.afm")) #pdfFonts(CM=CM)
#par(family="CM")
#pdf("snxsm.pdf",family="CM")
tikz("snxsm.tex",standAlone=TRUE)
persp(sn,sm,z,xlab="SN", 
ylab="SM",zlab="VI",theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol],border="white",lwd=0.5)
dev.off()
#dev.off()




2. What was your memory limit? i.e., I'm assuming you got an error similar
to:

Here is the error:

ERROR: TeX capacity exceeded, sorry [main memory size=1500000].

--- TeX said ---
\...@coremodel ...onvertcolorspec #1#2...@mod@gray #2\let #1...@mod@gray }\XC...
l.48916         cycle;
! ==> Fatal error occurred, no output PDF file produced!


I also tried to increase the main memory size, but somehow the strategies I tried did not work.

I hope that helps! I think it would be strange, if you could reproduce this without an memory error (with the same main memory size, of course).

Greetings,
Friedericksen




Charlie Sharpsteen wrote:
I could see how that might happen- persp creates many, many small rectangles
which results in a large file size and may operations for the TeX processor
to handle. I was able to compile the example you posted, but due to the
amount of graphic elements, it took a long time ~25 seconds.
If you have the time, do you think you could email me the following
feedback:

1. Was it the inclusion of one tikzDevice plot or a series of plots that
caused TeX to run out of memory?

2. What was your memory limit? i.e., I'm assuming you got an error similar
to:

  TeX capacity exceeded, sorry [main memory size=X].

What number was X?

Thanks very much for trying the package and for any information you have the
time to provide!

-Charlie


On Sun, Aug 30, 2009 at 11:00 PM, Friedericksen Hope <
friedericksen.h...@gmail.com> wrote:

Dear Charlie,

thank you very much for your response. The tikzDevice is a very nice
developing thing. I already tried to create my graphic with this device, but
unfortunately the created *.tex file exceeded the main memory size of my tex
processor. Therefore I tried the "classic" way of implementing the CMF.

Greetings,
Friedricksen



Charlie Sharpsteen wrote:

If you are trying to use Computer Modern fonts because the R graphics will
be included in a LaTeX report, you could try the TikZ Device Cameron
Bracken
and I wrote:
http://r-forge.r-project.org/projects/tikzdevice

The tikzDevice translates R graphics instructions into a LaTeX-friendly
format that can be included directly into documents where the font used in
the figure will match that used in the rest of the text.

<http://r-forge.r-project.org/projects/tikzdevice>It can be installed
from R

with the following command:

install.packages( 'tikzDevice', repos='http://r-forge.r-project.org')

The package is still in beta but we have had very good results so far-
tests
we have run with the persp function look great.

For your case, you would replace the call to pdf() with:

pdf("snxsm.tex")

And inside your tex document the figure code stored in snxsm.tex is
included
using the \input{} command:

\documentclass{whatever}

...
\usepackage{tikz}

...
\begin{document}

\begin{figure}

 \input{snxsm}

\end{figure}

...
\end{document}

Note you will need the TikZ package installed in your LaTeX distribution.
Installation of LaTeX packages is covered in Part 2 of the tikzDevice
vignette:

vignette( 'tikzDevice' )

Hope this helps!

-Charlie


On Sun, Aug 30, 2009 at 1:14 PM, Friedericksen Hope <
friedericksen.h...@gmail.com> wrote:

 Hello all,
I am trying to use computer modern fonts in my r grahics. I tried to do,
as
described here: http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html but
unfortunately, it does not work.

First of all I downloaded the cm-lgc package and the AFM and PFB-files
from
the page and put them in my R working directory, so far, so good.

Then I tried to run the following code:

 sn <- seq(1,7,length=100)

sm <- seq(0,4,length=100)
f <- function(x,y) {5.64080973 + 0.12271038*x - 0.27725481 * y +
0.29281216*x*y}
z <- outer(sn,sm,f)

nrz <- nrow(z)
ncz <- ncol(z)
jet.colors <- colorRampPalette( c("yellow", "red") ) nbcol <- 100
color <- jet.colors(nbcol)
zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
facetcol <- cut(zfacet, nbcol)

CM <- Type1Font("CM",
                   c("cm-lgc/fonts/afm/public/cm-lgc/fcmr8a.afm",
                     "cm-lgc/fonts/afm/public/cm-lgc/fcmb8a.afm",
                     "cm-lgc/fonts/afm/public/cm-lgc/fcmri8a.afm",
                     "cm-lgc/fonts/afm/public/cm-lgc/fcmbi8a.afm",
                     "cmsyase.afm")) postscriptFonts(CM=CM)
pdf("snxsm.pdf")
par(family="CM")
persp(sn,sm,z,xlab="SN",
ylab="SM",zlab="VI",theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol])
dev.off()

 It works fine, until the persp() function, there I get:
 persp(sn,sm,z,xlab="SN",

ylab="SM",zlab="VI",theta=-20,phi=20,r=5,shade=0.01,col=color[facetcol])
Error in persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",
 :  Invalid font type
In addition: Warning messages:
1: In persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",  :
 font family not found in PostScript font database
2: In persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",  :
 font family not found in PostScript font database
3: In persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",  :
 font family not found in PostScript font database
4: In persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",  :
 font family not found in PostScript font database
5: In persp.default(sn, sm, z, xlab = "SN", ylab = "SM", zlab = "VI",  :
 font family not found in PostScript font database

 Any help is appreciated! Also a hint/link how to install the CM fonts
under
R for general use, so that I don't have to have it in my wd all the time.

Thank you very much!

Greetings,
Friedericksen

______________________________________________
R-help@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.


       [[alternative HTML version deleted]]


______________________________________________
R-help@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.


        [[alternative HTML version deleted]]


______________________________________________
R-help@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.

Reply via email to