library(datasetsICR)library(ggplot2)data("seeds", package ="datasetsICR")ggplot(seeds, aes(y='width of kernel', x='length of kernel', color='variety',)) +geom_point()
# a) x and y axis labelslabs(x ="Width of Kernel", y ="Length of Kernel",title ="Scatter Plot with Categorical Variable",subtitle ="Primary Insight: The relationship between Compactness and Lenght of Kernel")
$x
[1] "Width of Kernel"
$y
[1] "Length of Kernel"
$title
[1] "Scatter Plot with Categorical Variable"
$subtitle
[1] "Primary Insight: The relationship between Compactness and Lenght of Kernel"
attr(,"class")
[1] "labels"
# c) Different color dot points for each level of the categorical variable# scale_color_manual(values = c("A" = "red", "B" = "blue", "C" = "green")) +# d) A legend# theme(legend.position = "right")