Dear R-experts,

Here below a toy R code example. I would like some countries (not all of them) 
"Italy", "Canada", "Greece" and "Norway" to appear in red color. The others 
remaining black. How can I do that without big changes in my R code ? Indeed, I 
would like my R code to remain like this as much as possible, for example, end 
of my R code, I want to keep the non-overlapping text label.

############
A<-c("Italy","Germany","USA","Canada","Turkey","Chile","Mexico","Japan","Norway","Finland","Greece")
B<-c(540,523,589,600,499,567,485,467,543,511,500)
C<-c(470,470,489,492,476,475,455,444,489,456,478)

mod1=loess(C~B,span=0.7)
Bfit=seq(from=min(C),to=max(C),length.out=100)
Afit1=predict(mod1,newdata=Bfit)
plot(B,C,main="Courbe de régression non paramétrique entre ISQ 2015 et ISQ 
2018", xlab="score ISQ 2015", ylab="score ISQ 2018 ",type="n")
points(Bfit,Afit1,type="l",lwd=2,col="red")

library(basicPlotteR) 
# Add non-overlapping text labels
addTextLabels(B, C, A, col.label="black")          
############

 

 

 

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to