Fixing a scatterplot with different colours and shapes
03:30 21 Oct 2026

Could you please asssit with this scatterplot?

I am having trouble creating a different colour for each of the areas (LandUse = Natural, Urban, & Urban-natural areas).

And when I changed the shape, two legends appeared, so how do I create one legend that has both the colour and shape combined? (See photo and code below)

Scatterplot



Theme <- # panel.grid.major -> controls major grid lines
  theme(panel.grid.major = element_blank(), 
        # panel.grid.minor -> controls minor grid lines
        panel.grid.minor = element_blank(),
        # panel.background -> controls background colour
        panel.background = element_blank(), 
        # axis.line, axis.ticks, axis.text changes axis line with and details
        axis.line = element_line(linewidth = 0.50, colour = "black"), 
        axis.ticks = element_line(linewidth = 0.50, colour = "black"), 
        axis.text = element_text(colour = "black"),
        # axis.text -> changes size of axes numbers
        axis.text.x = element_text(size=15, colour = "black"),
        axis.text.y = element_text(size=15, colour = "black"),
        # axis.title -> changes size of axes labels
        # vjust = moves label further away from numbers
        axis.title.y = element_text(size=14, vjust = +2.5),
        axis.title.x = element_text(size=14),
        # legend.text -> changes legend font size
        legend.text=element_text(size=14),
        # legend.title -> changes legend title size
        legend.title = element_text(size=15),
        # change font size of facet wrap
        strip.text = element_text(size = 14))

windows()
ggplot(data = dat, aes(x = Wing, y = Mass)) +
  geom_point(aes(color = LandUse, shape = LandUse), size = 2.5) +        
  labs(
    x = "WING LENGTH (mm)",
    y = "BODY MASS (g)",
    color = "Area",values = c("green", "darkgrey", "orange"))+
  scale_color_discrete(labels = c("Natural", "Urban", "Urban-natural"))+
  scale_x_continuous(limits = c(50,64), breaks = seq(50,64,2))+
  scale_y_continuous(limits = c(10,14), breaks = seq(10,14,1))+
  Theme +
  theme(plot.title = element_text(hjust = 0.03, vjust = -6))
r graph colors shapes scatter-plot