Jack
Jack

Reputation: 165

How to map lots of data points on one plot? when grouping by shape is not applicable

I'm trying to plot two metrics' scores from 50 simulations. I need to map each simulation on the plot but shape accepts only 8, and using color for 50 groups doesn't seem to look good on plot at all(I tried and it was terrible!) Any suggestions?

 myplot<- ggplot(new, aes(sppp_loss, history)) +
  geom_point(aes(colour = metric),
         position = position_jitter(width = 0.3, height = 0)) + 
 geom_smooth (aes(x=sppp_loss , y= history, color=metric, group=(metric)), method="lm", se=FALSE)

Subset of data

   metric   history    sppp_loss      sim
   ED_loss  1.209177471 5            tree1
   ED_loss  1.453112762 5            tree2
   ED_loss  1.174947503 5            tree3
   ED_loss  1.226344648 5            tree4
   ED_loss  0.972865697 5            tree5

cheers

Upvotes: 1

Views: 92

Answers (1)

eipi10
eipi10

Reputation: 93851

Since my comment solved your problem, I'm converting it to an answer:

You could use the value of sim as the actual point markers, but it will be very cluttered with 50 different values. At the least you'll want to shorten it to t1, t2, etc. (or even just the number alone), but faceting is a better option (as noted by @thelatemail). Anyway, here's a conceptual example using a built-in data set:

ggplot(mtcars, aes(factor(gear), mpg)) + 
     geom_text(aes(label=carb), position=position_jitter(width=0.2,height=0))

Upvotes: 1

Related Questions