See the FAQ: How to do a minimal reproducible example reprex
for beginners because your df.cars
is not visible.
par(mfrow = c(1,2))
a <- which(mtcars["am"] == 0)
b <- which(mtcars["am"] == 1)
plot(mtcars[a,]$mpg,mtcars[a,]$hp)
plot(mtcars[b,]$mpg,mtcars[b,]$hp)