The data has 4 columns (ProductType, M, P, and O) and 11 rows:
ProductType <- c("Instrument", "Refrigerator", "Laptop", "Toothpaste",
"MobileApp", "Cars", "Haircut", "WristWatch",
"Cellphone", "Detergent", "Movie")
M <- c(3.00, 3.67, 3.60, 2.33, 2.80, 3.80, 1.44, 3.50, 3.85, 2.71, 3.86)
P <- c(2.29, 2.93, 3.33, 3.00, 2.29, 3.53, 3.53, 3.33, 3.54, 2.92, 3.71)
O <- c(3.00, 2.67, 2.60, 1.86, 3.20, 3.27, 3.07, 1.91, 3.07, 2.09, 4.15)
d <- data.frame(ProductType, M, P, O)
I want to have product types (11 product names) in the X-axis and show the values of M, P, and O for each product type in the same plot. I can create the plot. However, now the viewer of the graph should see the color-coded dots in the plot and refer to legend to see if the color means M, P, or O. How could I have the letters "M", "P", "O" to show up in the graph instead of the dot with the associated color? In other words how could I change the red dots to "M", blue dots to "P" and Green dots to "O"?
The code I use is:
ggplot(d, aes(ProductType,y='Source Importance' ,
colour='Information Source', group=1)) +
geom_point(aes(y = M, colour = "M"),size = 10) +
geom_point(aes(y = O, colour = "O"),size = 10)+
geom_point(aes(y = P, colour = "P"),size = 10)