I'm trying to do a simple clustering example, but was wondering if there's a good way to make the colors align.
data = data.frame(iris$Petal.Length, iris$Petal.Width)
iris.kmeans <- kmeans(data, 3)
par(mfrow = c(1,2))
plot(x=iris$Petal.Length, y=iris$Petal.Width, col=iris.kmeans$cluster)
plot(x=iris$Petal.Length, y=iris$Petal.Width, col=iris$Species)
The output works, but gives me plots with color schemes that aren't aligned:
Is there a good way to force these two plots to have the same color schemes?