1

I used R to get different plots. I saved them as pdf. I went to my tex. file and I used \includegraphics command. The plot came but it does not have labels on, that is, x-labels, y-labels and title-labels. Please advice.

2
1

Whithout a minimal working example (see I've just been asked to write a minimal example, what is that?) is hard to guess the problem, but a way to overcome this problem and simplify your work is use Sweave (or knitr). Briefly:

1) First, you can make a file.Rnw like this:

\documentclass{article}
Some \LaTeX{} text.
\begin{document}
\SweaveOpts{concordance=TRUE}
<<echo=F,fig=T>>=
data(CO2)
attach(CO2)
plot(uptake~conc, xlab="x label", ylab="y label", main="The main label")
@
\end{document}

2) Then, compile it with R to obtain a file.tex:

R CMD Sweave file.Rnw

3) Finally, Compile your file.tex as usual to obtain file.pdf.

For simple files as the above MWE, or a working preview, where just one pdflatex compilation is enough, you can omit the step 3 and use the--pdf option in 2:

R CMD Sweave --pdf file.Rnw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.