An extension to this query, I have generated the plot using the approach suggested by eipi10.
valsToKeep <- c("D_1","D_4")
n <- length(valsToKeep)
getPaletteDark = brewer.pal(8,"Dark2")
colSel <- sample(getPaletteDark,n)
ggplot(df %>%
mutate(Val=fct_other(Val,keep=valsToKeep)) %>%
arrange(Val) %>%
filter(!duplicated(.[,c("X","Y")])),
aes(X,Y,col=Val)) +
geom_point() +
scale_colour_manual(values=c(colSel,"grey70")) +
theme_bw()
Similarly, I have tried to change mappings to other aesthetic values such as alpha
, shape
:
ggplot(df %>%
mutate(Val=fct_other(Val,keep=valsToKeep)) %>%
arrange(Val) %>%
filter(!duplicated(.[,c("X","Y")])),
aes(X,Y,col=Val)) +
geom_point() +
scale_colour_manual(values=c(colSel,"grey70")) +
scale_alpha_manual(values = c(rep(1,n),0.2)) +
scale_shape_manual(values = c(rep(16,n),1)) +
theme_bw()
but, it did not fetch the desired output (decrease transparency to hollow circles for Other
points).