[R] Using special characters
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jan 26 17:44:09 CET 2006
You haven't told us much, for example not your R version nor your exact
platform (nor if this is a binary or self-compiled version of R) nor your
locale.
And you (or something between you and me) have wrapped the R code onto
just two lines. You talk about saving as pdf, and ran a jpeg device,
unless I missed something in those messed-up lines.
I am afraid there is just too much uncertainty here. For current R, with
the pdf() device and a Latin-1 or UTF-8 locale, this should work. For a
jpeg() device, it depends on the fonts you have installed in your X11
server, but it usually works.
If you can explain whether you want pdf or jpeg and give the missing
details (and any others you think might be relevant), people here may be
able to help you further.
On Thu, 26 Jan 2006, Alexandra R. M. de Almeida wrote:
> Dear R users
>
> I'm having problems in putting special characters (like á, ã, ç ) in my plots, as much in titles, as in axis names, as in legend...when I save them as a pdf document. They don't appear...
> I don't know if it is because I'm using a linux platform...
> The script is the following:
>
> library(grDevices) jpeg(file="Fronteira/FronteiraNova.jpeg", bg="white", quality=100,width = 600, height = 480) grafico.fe<-function(varFA,retFA,varC,retC,covRF,retRF,varD,retD) { minx<-min(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) maxx<-max(100*sqrt(varFA),100*varC,100*sqrt(covRF[1,1]),100*sqrt(covRF[2,2]),100*sqrt(covRF[3,3]),100*sqrt(covRF[4,4]),100*varD) miny<-min(100*retFA,retC,retRF,retD) maxy<-max(100*retFA,retC,retRF,retD) plot(100*sqrt(varFA),100*retFA,type="l",lwd=2,col=2,xlab="Risco %", ylab="Retorno % (anualizado)", xlim=c(minx-0.01,maxx), ylim=c(miny,maxy),main="Fronteira Eficiente") points(100*varC,retC,pch=16,cex=0.6, col=3) points(100*sqrt(covRF[1,1]),retRF[1],pch=16,cex=0.6,col=4) points(100*sqrt(covRF[2,2]),retRF[2],pch=16,cex=0.6,col=5) points(100*sqrt(covRF[3,3]),retRF[3],pch=16,cex=0.6,col=6) points(100*sqrt(covRF[4,4]),retRF[4],pch=16,cex=0.6,col=7)
> points(100*varD,retD,pch=16,cex=0.6,col=1) legend(c(0.91,1.11),c(17.97,18.156),c("Fronteira Eficiente"),lwd=2,cex=0.6, col=2) legend(0.93,18.13,c("Consolidado","Brad","AB","It","Uni","Ot"),pch=16, bty="n", cex=0.6, col=c(3,4,5,6,7,1), ncol=1) } grafico.fe(varFA,retFA,varC,retC,covRF,retRF,varD,retD) dev.off()
>
> Do someome have a problem like this?
>
> Thanks
>
> Alexandra Almeida
>
>
>
>
> Alexandra R. Mendes de Almeida
>
>
>
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list