That code produces a text file that is 14 MB!! I have noticed that ggplot2 is not the most efficient in the way it does some of its plotting. But anyway, we have run into this problem with complex graphics before. You need to increase your tex capacity. See how to do that here:<div>
<br></div><div><a href="http://www.latex-community.org/forum/viewtopic.php?f=45&p=19031">http://www.latex-community.org/forum/viewtopic.php?f=45&p=19031</a></div><div><br></div><div>I was able to compile your example by setting <br>
<div><br></div><div>main_memory = 100000000</div><div><br></div><div>It takes a really long time though and the resulting pdf is still about 4 MB. Hope this helps. </div><div><br clear="all">-Cameron<br><br>--<br>Cameron Bracken<br>
Graduate Research Assistant<br>CADSWES<br>University of Colorado at Boulder<br><a href="mailto:cameron.bracken@colorado.edu">cameron.bracken@colorado.edu</a><br>(707) 986-8633<br>
<br><br><div class="gmail_quote">On Wed, Oct 28, 2009 at 2:02 PM, Mike Lawrence <span dir="ltr"><<a href="mailto:Mike.Lawrence@dal.ca">Mike.Lawrence@dal.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all,<br>
<br>
Not sure if there's likely to be a work-around on this, but I'm trying<br>
to create a figure for a manuscript and I've encountered a "TeX<br>
capacity exceeded, sorry" error when I try to render the pdf (<br>
system("/usr/texbin/pdflatex kappa.tex",int=T) ). I'm guessing this<br>
means that I don't have sufficient memory to render the pdf but I<br>
thought I'd double-check with the list to make sure there aren't any<br>
workarounds other than reducing the complexity of my figure or<br>
upgrading my RAM.<br>
<br>
Here's the code:<br>
<br>
library(CircStats)<br>
library(ggplot2)<br>
library(tikzDevice)<br>
<br>
#set some parameters<br>
circle_resolution = 1 #1=very high res, but pdflatex fails; 10=lower<br>
res but pdflatex succeeds<br>
kappa = exp(seq(0,4,length.out=10))<br>
x = seq(-180,180,circle_resolution)<br>
<br>
#generate data to plot as circles<br>
a = ldply(<br>
kappa<br>
, .fun = function(this_kappa){<br>
d = dvm(x*pi/180,0,this_kappa)<br>
d = d-min(d)<br>
d = d/max(d)<br>
to_return = data.frame(<br>
kappa = this_kappa<br>
, x = x<br>
, d = d<br>
)<br>
return(to_return)<br>
}<br>
)<br>
<br>
#get ready to make nice facet labels<br>
temp = sort(unique(a$kappa))<br>
temp = as.character(round(temp,1))<br>
temp[1] = '1.0'<br>
temp[9] = '35.0'<br>
<br>
#make nice facet labels (this is why I'm using tikz)<br>
a$kappa_print = factor(a$kappa,labels=paste('$\\kappa = ',temp,'$',sep=''))<br>
<br>
#start making the plot<br>
p = ggplot(<br>
data = a<br>
, mapping = aes(<br>
x = x<br>
, y = factor(1)<br>
, colour = d<br>
, fill = d<br>
)<br>
)+facet_wrap(~kappa_print,ncol=5,as.table=FALSE)+<br>
geom_bar(<br>
width=1<br>
,stat='identity'<br>
)+scale_fill_gradient(<br>
low = muted('blue')<br>
, high = muted('red')<br>
, space = 'Lab'<br>
)+scale_colour_gradient(<br>
low = muted('blue')<br>
, high = muted('red')<br>
, space = 'Lab'<br>
)+scale_y_discrete(<br>
name=''<br>
,breaks=100<br>
)+scale_x_continuous(<br>
name=''<br>
,breaks=0<br>
)+coord_polar(<br>
theta='x'<br>
)+opts(<br>
legend.position='none'<br>
, panel.grid.major = theme_blank()<br>
, panel.grid.minor = theme_blank()<br>
, axis.title.y = theme_blank()<br>
, axis.text.y = theme_blank()<br>
, axis.title.x = theme_blank()<br>
, axis.text.x = theme_blank()<br>
, axis.ticks = theme_blank()<br>
)<br>
<br>
#save using ggsave; works but can't get greek symbols in the facet<br>
labels, even using plotmath<br>
ggsave(p,file='kappa_ggsave.pdf',width = 10,height = 4.5)<br>
<br>
#save using tikz<br>
tikz("kappa_tikz.tex", width = 10,height = 4.5, standAlone =T)<br>
print(p)<br>
dev.off()<br>
<br>
#this next step fails when circle_resolution=1 (on my machine with 2GB RAM)<br>
system("/usr/texbin/pdflatex kappa_tikz.tex",int=T)<br>
<br>
<br>
--<br>
Mike Lawrence<br>
Graduate Student<br>
Department of Psychology<br>
Dalhousie University<br>
<br>
Looking to arrange a meeting? Check my public calendar:<br>
<a href="http://tr.im/mikes_public_calendar" target="_blank">http://tr.im/mikes_public_calendar</a><br>
<br>
~ Certainty is folly... I think. ~<br>
_______________________________________________<br>
Tikzdevice-bugs mailing list<br>
<a href="mailto:Tikzdevice-bugs@lists.r-forge.r-project.org">Tikzdevice-bugs@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/tikzdevice-bugs</a><br>
</blockquote></div><br></div></div>