0

I'm a newbie to sweave and latex and I have a problem importing a plot figure in Latex.

I used the xyplot() from the lattice package. I did include print() in the code, but when I sweave, there is warning in R, saying "file name 'xxxx' is not portable.

My code is like this:

\begin{figure}[H]

\begin{center}

<< fig=TRUE,echo=FALSE>>=

plot1=xyplot(Percentage~Age,type="b", group=Consonant.Type,data=m1,main="Lenition of /sm, sp, st, sg/ vs. others ",auto.key =list(lines = TRUE))

print(plot1)

@

\end{center}

\caption{Lenition of /sm, sp, st, sg/ vs. others by age}

\end{figure}
Sven Hohenstein
  • 80,497
  • 17
  • 145
  • 168
charlotte
  • 107
  • 1
  • 1
  • 11
  • So....what's the file name? Sweave appears to just be checking file names against `.SweaveValidFilenameRegexp <- "^[[:alnum:]#+-_]+$"`. – joran Feb 12 '14 at 15:38
  • strip that figure out of your main file, wrap it in a latex document, create some data in the chunk, and see if it still gives that error. That works for me. – Spacedman Feb 12 '14 at 15:39
  • @Spacedman Thanks! Now the figure appears on the pdf! But how to get rid of the file name in the pdf. The file name of the figure is "age effects-003.pdf" and I don't want this to shown in the pdf. – charlotte Feb 12 '14 at 15:48
  • @joran The file name is "age efects-003.pdf". is it because of the "-" in the file name? – charlotte Feb 12 '14 at 15:56
  • Do you mean the filename is visible in the PDF next to or near the graph? Like in a caption or something? That would be odd, and we'd have to see the generated .tex file to figure out how that happened. – Spacedman Feb 12 '14 at 16:49
  • @Spacedman yes, just like what you said. it's actually in the space between the graph and my caption of the graph. really odd. and I don't see any weird things in the .tex file. anyway, although my problem of getting the graphs in the pdf file is solved for now, but does that mean I have to generate graphs separately each time I use the xyplot()? I still don't understand what's doing the weird work. – charlotte Feb 12 '14 at 20:45

0 Answers0