Я бы проверил, является ли Модель %in%
файлом, и создал highlight
манекен, который равен 1
для отсутствия совпадения и 2
для совпадения. Затем используйте цветной вектор clr
и подмножество его с помощью макета.
dat <- transform(dat, highlight=1+(dat$Model %in% unlist(m.names)))
clr <- c("red", "green")
Просто сделайте график с помощью with
, чтобы можно было идентифицировать макет highlight
.
with(dat,
plot(log(HP), log(Av.), pch=16, cex=1,
xlim=c(min(konA.temp, konB.temp), max(konA.temp, konB.temp)),
ylim=c(min(konA.temp, konB.temp), max(konA.temp, konB.temp)),
xlab='log(konA)', ylab='log(konB)', col=clr[highlight]))
Выглядит так:
![enter image description here](https://i.stack.imgur.com/3ghU1.png)
Данные:
dat <- read.table(header=T, text="Model HP Av.
Integra 140 15.9
Legend 200 33.9
Century 90 172
LeSabre 100 172
535i 208 30
Century2 110 15.7
LeSabre2 170 20.8
Roadmaster 180 23.7")
m.names <- read.table(text="Integra
Legend
90
100
535i
Century
Century2
LeSabre
Roadmaster
Riviera
DeVille
Seville
Cavalier")