[R] Plot with some countries in red

PIKAL Petr petr@p|k@| @end|ng |rom prechez@@cz
Wed May 19 15:47:49 CEST 2021


For your example

sel <- c(1,4, 9, 11)
text(B, C, A, col=  c("black", "red")[(A %in% A[sel])+1])

gives you required colouring.Not sure if it works with basicPlotteR.


-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of varin sacha via R-help
Sent: Wednesday, May 19, 2021 3:14 PM
To: r-help using r-project.org
Subject: [R] Plot with some countries in red

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.


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")

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

R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

More information about the R-help mailing list