Hi,
I am having a problem getting my R plot into latex. I save it as a pdf
which looks fine. But when I write the code to pull it into Latex, it only
shows the graph (and not the x and y labels and title). I was wondering what
I was doing wrong? I've tried messing with the R font and the size of the
pdf. This is my latex code:
\graphicspath{{C:/graphics/}}
\begin{center}
\begin{figure}[h]
\includegraphics{PS2_1.pdf}
\end{figure}
\end{center}
Has anyone had success importing the entire R plot?
Many thanks,
- Carly
On Sun, Feb 7, 2010 at 1:43 PM, Maya Sen <msen at fas.harvard.edu> wrote:
Hey all,
A question came up on how to do factorials in R. The answer is that you
can use the factorial function ("factorial"). So, for example:
factorial(6)
[1] 720
6*5*4*3*2*1
[1] 720
Another question that came up was how to save the plots and figures that
you create in R. There are a few ways to do it, but I like to save my plots
as PDF's using the following type of command:
pdf(file= "myPlot.pdf", width = 5, height = 5, family = "Helvetica",
pointsize = 10)
## opens device to save plot, you can specify size, font, etc
plot(xVec, yVec)
## creates plot -- you can also use here "hist" or the "curve"
functions, of course
dev.off()
## closes device and finishes saving
If you move forward saving your plots as PDFs, then you should compile
your LaTeX code using pdflatex. Otherwise, you might get an error.
hope that helps,
Maya
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
--
Carly Knight
Ph.D. Student
Department of Sociology
Harvard University
Phone: (281) 682-4063
E-Mail: crknight at
fas.harvard.edu
--
Carly Knight
Ph.D. Student
Department of Sociology
Harvard University
Phone: (281) 682-4063
E-Mail: crknight at