There are multiple way to achieve what you want in R. One is mentioned in the link in Tung's comment.
Another way to approach this is create a color varialbe and assign values to it and create a vector of colors with names is corresponded with the variables you use with scale_color_manual
# Sample dataframe
x <- data.frame(x = seq(1, 10, by = 1),
y = seq(1, 10, by = 1),
color = c("color 1", "color 2", "color 3", "color 4", "color 5",
"color 6", "color 7", "color 8", "color 9", "color 10"))
# color map
color_map <- c("red", "green", "yellow", "orange", "black",
"grey50", "blue", "pink", "cyan", "purple")
names(color_map) <- x[["color"]]
library(ggplot2)
ggplot() + geom_point(data = x,
mapping = aes(x = x, y = y, size = 5, color = color)) +
scale_color_manual(values = color_map)

# Another example with less colors and using Hex code instead of color name
x <- data.frame(x = seq(1, 10, by = 1),
y = seq(1, 10, by = 1),
color = c("color 1", "color 2", "color 3", "color 4", "color 5",
"color 1", "color 2", "color 3", "color 4", "color 5"))
# Red Green Yellow Orange Black
color_map <- c("#FF0000", "#00FF00", "FFFF00", "FFA500", "000000")
names(color_map) <- c("color 1", "color 2", "color 3", "color 4", "color 5")
library(ggplot2)
ggplot() + geom_point(data = x,
mapping = aes(x = x, y = y, size = 5, color = color)) +
scale_color_manual(values = color_map)
