1

I have a table with two columns of number X and Y, and one column of strings called crystals.

crystals
 A
 A
 B
 C
 B
 D
 B
 C

Using ggplot2, how can I make a scatter plot of X versus Y with two types of points only, one shape for Crystals A, B, C and one shape for crystals D?

Tried to create subset but have not found a way to make 2 groups out of the 4 different values. I also tried to assign manually the same shape for A, B and C but then get a legend with the 4 entries instead of 2.

  • 1
    Create a new column and place new classification, then use group by this new column. Without example code I can't show you how to do it. – aldo_tapia Nov 28 '16 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.