[R] Printing localized pdf file from Sweave snippets
Hello! I am struggling for quite some time with proper printing of local characters in pdf plot, via Sweave snippets in Rnw file. When I am working directly within R, all is fine and I can get local character properly, like: pdf('figs/fig-relativeEntropy0.pdf', h=6, w=6, encoding='CP1250') matplot(par[, c(3)], type='b', ylim=c(0,0.5), xaxt='n', pch=c(21), lty=c('dashed'), lwd=c(3), xlab='', ylab='') axis(1, at=1:6, labels=as.character(par$suffix), cex.axis=1.2) legend(2, 0.48, 'pučina (open-sea)', bty='n', cex=1.2) dev.off() However, in Rnw file, I made an preamble line: \usepackage{Sweave} \usepackage[cp1250]{inputenc} From this, I am getting dots. Also, I tried to play with the: pdf.options(encoding='CP1250') within the Sweave snippet. No luck at all! Please, is there a straightforward solution?!? I read two links, but no sign of correct how-to: http://stackoverflow.com/questions/3434349/sweave-not-printing-localized-characters http://r.789695.n4.nabble.com/Problems-with-Sweave-and-pdf-options-encoding-quot-ISOLatin7-quot-PR-13234-td921653.html Many thanks! PM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Printing localized pdf file from Sweave snippets
On 14/09/2012 7:07 AM, Petar Milin wrote: Hello! I am struggling for quite some time with proper printing of local characters in pdf plot, via Sweave snippets in Rnw file. When I am working directly within R, all is fine and I can get local character properly, like: pdf('figs/fig-relativeEntropy0.pdf', h=6, w=6, encoding='CP1250') matplot(par[, c(3)], type='b', ylim=c(0,0.5), xaxt='n', pch=c(21), lty=c('dashed'), lwd=c(3), xlab='', ylab='') axis(1, at=1:6, labels=as.character(par$suffix), cex.axis=1.2) legend(2, 0.48, 'pučina (open-sea)', bty='n', cex=1.2) dev.off() However, in Rnw file, I made an preamble line: \usepackage{Sweave} \usepackage[cp1250]{inputenc} From this, I am getting dots. Also, I tried to play with the: pdf.options(encoding='CP1250') within the Sweave snippet. No luck at all! Please, is there a straightforward solution?!? I read two links, but no sign of correct how-to: http://stackoverflow.com/questions/3434349/sweave-not-printing-localized-characters http://r.789695.n4.nabble.com/Problems-with-Sweave-and-pdf-options-encoding-quot-ISOLatin7-quot-PR-13234-td921653.html This isn't really an answer to your question, but it might be a workaround: switch to the UTF-8 encoding. It is the default on many systems (e.g. most Unix-alikes these days), so it is probably better supported internally. You might need to convert your string to UTF8; you can do that by replacing 'pučina (open-sea)' with 'pu\u010dina (open-sea)' Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Printing localized pdf file from Sweave snippets
Hello! Many thanks, but this is not working. I put: \usepackage[utf8]{inputenc} and than: 'pu\u010dina (open-sea)' Blank space is printed in pdf file, after R CMD Sweave and pdflatex. Please, any other idea?! I am losing my mind here... Best, PM This isn't really an answer to your question, but it might be a workaround: switch to the UTF-8 encoding. It is the default on many systems (e.g. most Unix-alikes these days), so it is probably better supported internally. You might need to convert your string to UTF8; you can do that by replacing 'pučina (open-sea)' with 'pu\u010dina (open-sea)' Duncan Murdoch On Fri, 2012-09-14 at 08:17 -0400, Duncan Murdoch wrote: On 14/09/2012 7:07 AM, Petar Milin wrote: Hello! I am struggling for quite some time with proper printing of local characters in pdf plot, via Sweave snippets in Rnw file. When I am working directly within R, all is fine and I can get local character properly, like: pdf('figs/fig-relativeEntropy0.pdf', h=6, w=6, encoding='CP1250') matplot(par[, c(3)], type='b', ylim=c(0,0.5), xaxt='n', pch=c(21), lty=c('dashed'), lwd=c(3), xlab='', ylab='') axis(1, at=1:6, labels=as.character(par$suffix), cex.axis=1.2) legend(2, 0.48, 'pučina (open-sea)', bty='n', cex=1.2) dev.off() However, in Rnw file, I made an preamble line: \usepackage{Sweave} \usepackage[cp1250]{inputenc} From this, I am getting dots. Also, I tried to play with the: pdf.options(encoding='CP1250') within the Sweave snippet. No luck at all! Please, is there a straightforward solution?!? I read two links, but no sign of correct how-to: http://stackoverflow.com/questions/3434349/sweave-not-printing-localized-characters http://r.789695.n4.nabble.com/Problems-with-Sweave-and-pdf-options-encoding-quot-ISOLatin7-quot-PR-13234-td921653.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Printing to PDF in for
Hi everybody, I would like to ask if it is possible using pdf function or some other to print plots in cycle such that every new plot is on new page. like this pdf(file=D:/Plot.pdf,width = 9.25,height=9.25, family=Helvetica,pointsize=8,bg=white) for (i in 1:10){ x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) } dev.off( ) but the problem is that I have a lot of other code in the cycle which I don't want to be printed in PDF. Thanks a lot for the help [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Printing to PDF in for
See the onefile and file arguments of ?pdf and then do something like this : pdf( file = plot-%03d.pdf, onefile = FALSE, width = 9.25, height = 9.25, family=Helvetica,pointsize=8,bg=white ) Romain On 12/14/2009 12:09 PM, Trafim Vanishek wrote: Hi everybody, I would like to ask if it is possible using pdf function or some other to print plots in cycle such that every new plot is on new page. like this pdf(file=D:/Plot.pdf,width = 9.25,height=9.25, family=Helvetica,pointsize=8,bg=white) for (i in 1:10){ x- seq(1,40,1) y- 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) } dev.off( ) but the problem is that I have a lot of other code in the cycle which I don't want to be printed in PDF. Thanks a lot for the help -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/HlX9 : new package : bibtex |- http://tr.im/Gq7i : ohloh `- http://tr.im/FtUu : new package : highlight __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.