[R] Text Contrast in a Plot

Mark Difford mark_difford at yahoo.co.uk
Fri Apr 24 19:52:57 CEST 2009


Hi Rodrigo,

>> I would appreciate any suggestion on how can I make a text I’ve inserted
>> in
>> a plot show some contrast? 

There are quite a few approaches, but why not try legend?

Best, Mark.


Rodrigo Aluizio wrote:
> 
> Hi List,
> 
> I would appreciate any suggestion on how can I make a text I’ve inserted
> in
> a plot show some contrast? With this I mean that I have a white text on a
> plot and I would like to make a tiny border around it in black, so even
> being small sized and the entire graphic being small in the text page I’ll
> insert it. It will be visible.
> 
>  
> 
> Well I tried inserting a box() function inside the text() function, R
> accepts the command but there is no effect. I even tried to plot a greater
> black text and then a smaller white one at the same place, but it doesn’t
> look good.
> 
>  
> 
> Any ideas!
> 
>  
> 
> Bellow is my plot code without the above mentioned attempts. I’d like to
> add
> this effect at the second text() command.
> 
>  
> 
> png('BaseMap.png',width=5.2,height=3.6,pointsize=5,units='in',bg=NA,restoreC
> onsole=T,res=1200)
> 
> par(mar=c(5,0,0,0))
> 
> map('worldHires','brazil',ylim=c(-5.15,-4.55),xlim=c(-37,-36.1),type='n')
> 
> rect(-37.1,-5.25,-36,-4.9,density=NULL,angle=45,col='#dbf4ff',border=F)
> 
> plot(Batimetria,ylab='',xlab='',border=F,col=Cor$Cor,add=T)
> 
> plot(Municipios,ylab='',xlab='',col=rgb(245,232,140,max=255,alpha=255),add=T
> ,lwd=0.2)
> 
> axis(1,xaxp=c(-37,-36.1,5),cex.axis=1.5)
> 
> axis(2,yaxp=c(-5.15,-4.55,5),cex.axis=1.5)
> 
> text(Prof$Long,Prof$Lat,rownames(Prof),col='black',cex=0.9,srt=-24,font=2)
> 
> text(c(-36.96,-36.96,-36.865,-36.54,-36.37,-36.2),c(-4.96,-5.05,-5.11,-5.14,
> -5.14,-5.14),c('Areia
> 
> Branca','Serra
> 
> do Mel','Porto do
> Mangue','Macau','Guamaré','Galinhos'),col='Black',cex=1.3,font=2)
> 
> rect(-36.20,-4.56,-36.155,-4.565,density=NULL,angle=45,col='black',border='b
> lack',lwd=0.1)
> 
> rect(-36.155,-4.56,-36.111,-4.565,density=NULL,angle=45,col='white',border='
> black',lwd=0.1)
> 
> text(c(-36.20,-36.155,-36.111,-36.215),c(-4.573,-4.573,-4.573,-4.562),c('0',
> '5','10','km'),col='white',cex=1)
> 
> Norte(-36.155,-4.60,0.02)
> 
> box(which='plot',lty='solid')
> 
> dev.off()
> 
>  
> 
> Thanks in advance!
> 
>  
> 
> -------------------------------------------------------------
> 
> MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio
> 
> Centro de Estudos do Mar/UFPR
> Laboratório de Micropaleontologia
> Avenida Beira Mar s/n - CEP 83255-000
> Pontal do Paraná - PR – Brasil
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Text-Contrast-in-a-Plot-tp23217307p23221789.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list