Problem
This seems like a mistake, but it is a problem with pdf(), not with Sweave().
, , pdf(). , :
pdf("pdfPlot.pdf")
plot(0.5, 0.5, xlim = c(0,1), ylim = c(0,1))
legend("bottomright", c("data", "summary", "curve", "conf. region"),
pch = c(2,1,NA,NA), lwd = c(NA,NA, 2,1))
dev.off()
, cairo_pdf() , :
cairo_pdf("cairo_pdfPlot.pdf")
plot(0.5, 0.5, xlim = c(0,1), ylim = c(0,1))
legend("bottomright", c("data", "summary", "curve", "conf. region"),
pch = c(2,1,NA,NA), lwd = c(NA,NA, 2,1))
dev.off()
1: knitr.
knitr, . dev="cairo_pdf" (, , fig=TRUE), :
<<dev="cairo_pdf">>=
...
...
@
, library(knitr); knit("myScript.Rnw") Sweave("myScript.Rnw")
2. \includegraphics {}.
Sweave(), - :
<<results=tex, term=FALSE, echo=FALSE>>=
cairo_pdf("myPlot.pdf", width=5)
plot(0.5, 0.5, xlim = c(0,1), ylim = c(0,1))
legend("bottomright", c("data", "summary", "curve", "conf. region"),
pch = c(2,1,NA,NA), lwd = c(NA,NA, 2,1))
dev.off()
cat("\\includegraphics{myPlot.pdf}\n\n")
@