0

Apologies for another question on this subject, but I have read the others and it hasn't helped me in any way.

I am trying to create a generic xy scatterplot of geochemistry which, once the code is working, will have several layers of points added based on the sample. The code I am using I have adapted from some I was originally using with a discrete x axis but I have changed this variable to continuous and it still isn't working. I do not want to remove the continuous scale commands so it is set automatically, because I want to compare the data between similar graphs with similar scales.

Here is a subset of my data:

Si <- structure(list(Zr_TiO2 = c(83.19, 115.64, 90.63, 179.36, 526.05, 104.61, 51.61, 72.66, 255.9, 109.9, 96.11, 246.82, 83.33, 99.33, 86.62), SiO2 = c(54.1, 43.8, 48.92, 39.81, 54.99, 49.28, 49.28, 46.4, 53.9, 49.25, 48.06, 55.31, 48.13, 51.18, 51.09), Sample = c(1L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L)), .Names = c("Zr_TiO2", "SiO2", "Sample"), row.names = c(NA, 15L), class = "data.frame")

And here is the code I am using:

a <- Si$Zr_TiO2[Si$Sample == '1']
Si$Zr_TiO2 <- factor(Si$Zr_TiO2,levels = a)
ggplot(data=Si[Si$Sample == '1',]) +
geom_point(aes(y=SiO2, x=Zr_TiO2,group = a), pch=0, colour="black", size=0.8) +
scale_y_continuous("SiO2 (ppm))", limits = c(0,90), breaks=c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90)) +
scale_x_continuous("Zr / TiO2", limits = c(0,500), breaks=c(0,100,200,300,400,500))
kdopen
  • 8,032
  • 7
  • 44
  • 52
Holly Elliott
  • 103
  • 3
  • 10

0 Answers0