Using shape AND color to distinguish points in a scatter plot

I have a scatterplot where the points belong to 15 classes. I try to use color to distinguish the points classes:

ggplot(df, aes(V3, V4, color=V1)) + geom_point()

The problem is that it is difficult to distinguish 15 colors. I could use shape instead of colors but there are two few shapes.

I understand how I can use shape and color to distinguish two different class aspects of a geo, but here I only want to distinguish one class, but the thing is the class number is high, so I want to combine shape and color to make points class belonging easier to distinguish.

So what I ideally want is to use the six shapes and cycle through the colors. Is there an easy way to do that with ggplot?

1 Like

Like this?

                shape = manufacturer,
                colour = manufacturer)) + 
  geom_jitter(height = 0.25, width = 0.25, size = 2) + theme_classic() +
  scale_shape_manual(values = rep(0:5, 4)) + 
  scale_color_manual(values = rep(c("red", "blue", "green"), 3, each = 6))

You can define the number and the order of the shapes and the colours individually.
Here the shapes 0:5 are used, so 6 shapes, repeated 3 4 times. Then 3 different colours, each repeated for 6 times, so each batch of the shapes is shown in one colour.

image

5 Likes

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