-1

I'm trying to plot this data frame in a point-plot, and I want to divide the data in three different groups according to the size with three different colours:

Size    pH
0,001   4,308
0,001   4,269
0,001   4,273
0,5     4,436
0,5     4,406
1,5     4,384
1,5     4,385
Uwe
  • 41,420
  • 11
  • 90
  • 134
Davide
  • 1
  • what code have you tried? here is a great ggplot2 intro from Harvard http://tutorials.iq.harvard.edu/R/Rgraphics/Rgraphics.html – Nate Mar 12 '17 at 18:01
  • Please add a reproducible example and show us what you have tried. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Pierre Lapointe Mar 12 '17 at 18:58

1 Answers1

1

Here's a solution using lattice:

library(lattice)

pH <- runif(18, 1, 7)    
dd <- data.frame(pH, size = c(0.001, 0.5, 1.5))

xyplot(pH ~ seq_along(pH), groups = size, data = dd, auto.key = TRUE)

enter image description here

Johan Larsson
  • 3,496
  • 18
  • 34