I want to visualize the feature space in my training areas using scatterplots. I use a nested classification schema, so my class values are not incrementing but sorted in categories like 100 (mainclass), 110 (subclass)... I have color values already specified for each class by the GIS I'm using to digitalize the training areas, so I want to have them in the scatterplot.
I already tried to update the palette with my color vector but the results are not satisfying at all. After some experimentation I noticed that for incrementing class values the result would be satisfying.
Here is a representative example:
b1 <- c(1:50)
b2 <- runif(b1, b1-10, b1+10)
val1 <- c(rep(1,10), rep(2,10), rep(3,10), rep(4,10), rep(5,10))
val2 <- c(rep(110,10), rep(120,10), rep(200,10), rep(300,10), rep(800,10))
df <- data.frame(b1, b2, val1, val2)
par(mfrow=c(2,2))
palette("default")
plot(df$b1, df$b2, col= df$val1, pch = 20)
plot(df$b1, df$b2, col= df$val2, pch = 20)
palette(c("#FF0000", "#FB5DF6", "#AF3C96", "#857EC7", "#E8D1D1"))
plot(df$b1, df$b2, col= df$val1, pch = 20)
plot(df$b1, df$b2, col= df$val2, pch = 20)
which will result in:
The plot at bottomleft would be satisfying. How can I match my palette to the not incrementing categories on the bottomright image column?