My plot seams less saturated

Please help me why is my plot seams dull... how to make it pop the colours when ever i use both the colour and shape within the aes() it produces like this.... but not when i use only either one of them only within aes()

#Resudual Plot
library(ggplot2)
library(tidyverse)
resids=lm_fit_final2$residuals
resudual_Plot_2 = data_frame(Predicted = predicted_Koc$predicted_value,Residual = lm_fit_final2$residuals,Category=Final_Master_Data_With_PFAS$Category)
median(resids)
ggplot(resudual_Plot_2,aes(Predicted,Residual),+ aes(xlab("Predicted"),ylab("Residuals")))+geom_point(aes(shape = Category,color=Category),size= 2) + geom_hline(yintercept = -0.03848633)+coord_equal()+theme_classic()


Residual

Hi @Naarayanan777,
To increase the contrast between your categories of points you may like to specify the colours. We don't have your data, so here is an example using your modified code:

library(ggplot2)
library(tidyverse)

lm_fit_final2 <- lm(mpg ~ disp, data=mtcars)
resids <- lm_fit_final2$residuals
fitted <- fitted(lm_fit_final2)
category <- c(rep(1, 20), rep(2, 12))  # Dummy category

residual_Plot_2 <- data.frame(Predicted = fitted,
                              Residual = resids,
                              Category = factor(category))
my_med <- median(resids)
ggplot(residual_Plot_2, aes(Predicted, Residual)) + 
  xlab("Predicted") +
  ylab("Residuals") +
  geom_point(aes(shape = Category, color = Category), size= 3) + 
  geom_hline(yintercept = my_med) +
  coord_equal() +
  theme_classic() +
  scale_color_manual(values=c("red", "blue"))

Created on 2020-05-25 by the reprex package (v0.3.0)

You also have a lot of points overlap: you may like to add an alpha = 0.2 value.
HTH

Thank you so much sir, for the idea..have done some changes and finally got it right....But when i use alpha =0.2 it kinda collapse...but when i not mentioned it kinda good but still some points overlap a little..i have experimented with alpha= to various values but still they collapse...so i kinda removed it..So what will be the reason sir? i have like 450 values

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.