-1

How can I change color labels for figures labels? colors ("red", "blue") for (Triangle, square)


    ggplot(plasmacicatriz, aes(Carbono, Nitrogeno)) +
      geom_errorbar(aes(xmin = -14.7, xmax = -13.9, y = 16.7), width = 0.1) +
      geom_errorbar(aes(xmin = -16.1, xmax = -14.6, y = 14.6), width = 0.1) +
      geom_errorbar(aes(ymin = 16.5, ymax = 17.0, x = -14.3), width = 0.1) +
      geom_errorbar(aes(ymin = 14.2, ymax = 15.1, x = -15.3), width = 0.1) +
      geom_point(aes(-14.3, 16.7, color = Cicatriz == "Abierta"), size = 3) +
      geom_point(aes(-15.3, 14.6, color = Cicatriz=="Cerrada"), size = 3) +
      scale_color_manual(name = "Cicatríz umbilical", values = c("red", "blue"), labels = c("Abierta", "Cerrada")) +
      xlim(c(-17, -13)) +
      ylim(c(13.5, 17.5)) +
      xlab(expression(paste(delta^{13}, "C(‰)"))) +
      ylab(expression(paste(delta^{15}, "N(‰)")))

enter image description here

I tried with this

```{r}
  ggplot(plasmacicatriz, aes(Carbono, Nitrogeno)) +
  geom_errorbar(aes(xmin = -14.7, xmax = -13.9, y = 16.7), width = 0.1) +
  geom_errorbar(aes(xmin = -16.1, xmax = -14.6, y = 14.6), width = 0.1) +
  geom_errorbar(aes(ymin = 16.5, ymax = 17.0, x = -14.3), width = 0.1) +
  geom_errorbar(aes(ymin = 14.2, ymax = 15.1, x = -15.3), width = 0.1) +
  geom_point(aes(-14.3, 16.7, shape = Cicatriz == "Abierta"), size = 3) +
  geom_point(aes(-15.3, 14.6, shape = Cicatriz=="Cerrada"), size = 3) +
  scale_shape_manual(name = "Cicatríz umbilical", labels = c("Abierta", "Cerrada"), values = c(0,1)) +
  xlim(c(-17, -13)) +
  ylim(c(13.5, 17.5)) +
  xlab(expression(paste(delta^{13}, "C(‰)"))) +
  ylab(expression(paste(delta^{15}, "N(‰)")))
```

but the result is this, both elements have the same figure and I don't know how to fix it: enter image description here

edna
  • 13
  • 1
  • 6
  • Welcome SO ! Please provide a reproducible example of your dataset: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – dc37 Apr 23 '20 at 06:03

1 Answers1

0

Maybe you can try to pass "Cicatriz" as color and shape argument into aes:

ggplot(plasmacicatriz, aes(Carbono, Nitrogeno, color = Cicatriz, shape = Cicatriz)) +
  geom_errorbar(aes(xmin = -14.7, xmax = -13.9, y = 16.7), width = 0.1) +
  geom_errorbar(aes(xmin = -16.1, xmax = -14.6, y = 14.6), width = 0.1) +
  geom_errorbar(aes(ymin = 16.5, ymax = 17.0, x = -14.3), width = 0.1) +
  geom_errorbar(aes(ymin = 14.2, ymax = 15.1, x = -15.3), width = 0.1) +
  geom_point(aes(x = c(-14.3,-15.3), y = c(16.7,14.6)), size = 3) +
  scale_color_manual(name = "Cicatríz umbilical", values = c("red", "blue"), labels = c("Abierta", "Cerrada")) +
  scale_shape_manual(name = "Cicatríz umbilical", values = c(16,17), labels = c("Abierta", "Cerrada"))+
  xlim(c(-17, -13)) +
  ylim(c(13.5, 17.5)) +
  xlab(expression(paste(delta^{13}, "C(‰)"))) +
  ylab(expression(paste(delta^{15}, "N(‰)")))

Does it answer your question ?

If not, please provide a reproducible example of your dataset plasmacicatriz as described in this link: How to make a great R reproducible example

dc37
  • 15,840
  • 4
  • 15
  • 32