В целом, вы можете инициализировать пустой plot
, а затем points
на соответствующих подмножествах с желаемыми цветами.
with(dataset, plot(col1, col2, xlab="col1", ylab="col2", type="n"))
with(dataset[1:3, ], points(col1, col2, pch=16, col="red"))
with(dataset[-(1:3), ], points(col1, col2, pch=16, col="blue"))
![enter image description here](https://i.stack.imgur.com/a82BJ.png)
Данные
dataset <- structure(list(col1 = 1:5, col2 = c(1, 1, 1, 1, 1)), class = "data.frame", row.names = c("a",
"b", "c", "d", "e"))