Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is less of a question than a warning. In LyX 2.1.0 with pgfSweave under Ubuntu 10.04 I've been trying to generate a number of plots with a for loop. For example

<<fig=TRUE>>=
for (lala in 1:200) { hist(rpois(1234,lala)); }
@

. After a long period of experimentation I'm confident saying that the loop works for for(lala in 1:20), for(lala in 21:40), for(lala in 41:60), ..., for(lala in 181:200), but not for more than twenty plots at a time.

Strange, I know, and if I come up with a resolution to the problem I'll post it.

share|improve this question
Does pgfSweave really have the capability of making plots from a for loop like that? I've always generated them in a for loop but then used cat to write out the LaTeX code, just like you have to do for regular Sweave. (On the other hand, judging by the missing parentheses, maybe this is meant to be pseudo-code, in which case, a reproducible example would be helpful.) Thanks for your clarification. – Aaron Nov 14 '11 at 3:13
@Aaron Missing parentheses fixed, thanks for the correction. To actually run the code just insert something like plot(hist(rpois(33,i))). What do you mean by cat to write out the LaTeX code? I am doing this within LyX. – isomorphismes Nov 14 '11 at 4:03
@Aaron "I've always generated them in a for loop but then used cat to write out the LaTeX code, just like you have to do for regular Sweave." Do you have a link that explains this? – isomorphismes Nov 14 '11 at 4:15
1  
See the Sweave FAQ. Sorry I can't get the link right now but it should be easy to google for. – Aaron Nov 14 '11 at 5:10
show 2 more comments

closed as not a real question by Joseph Wright Feb 4 '12 at 22:51

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

Browse other questions tagged or ask your own question.