Home > Back-end >  How to change the shapes of the dots in the ggerrorplot
How to change the shapes of the dots in the ggerrorplot

Time:06-04

I want to change the shape of the dots in my ggpubr graphic. My overall aim is that I don't want to use colors for my print. I am not so familiar with the ggpubr graphics but I use them for the asteriks.

How can I change the shape of the points? I need 7 different shapes. The input argument shape = "combi" did not change anything. So how could I get what I want?

ggerrorplot(subset_PUFA_together, x = "Lipid_Species", y = "isotopic_ratio",
                    add = "mean", error.plot = "errorbar", color = "combi", 
                                                            palette = c( "#009E73","#E69F00","#F0E442",
                                                                       "#0072B2", "#D55E00", "#CC79A7", "#000000"),
                    legend = "right",position = position_dodge(width=0.4),
                    size = 1.4, xlab = "", ylab = "") 

Thanks, Nadine

PS: Some data for playing around:

structure(list(Lipid_Species = structure(c(3L, 3L, 2L, 2L, 3L, 
6L, 4L, 6L, 2L, 5L), .Label = c("LIN", "ALA", "SDA", "EPA", "ARA", 
"DHA"), class = "factor"), isotopic_ratio = c(NA, -47.8432292, 
-40.4566585, -43.2375195, NA, NA, -41.1712774, NA, -38.7533203, 
-45.66419779), combi = structure(c(3L, 4L, 5L, 3L, 2L, 1L, 7L, 
2L, 2L, 3L), .Label = c("Fresh leaves", "Submerged leaves", "Epilithon", 
"Emphemeroptera (Grazer)", "Plecoptera (Shredder)", "Gammarus (Shredder)", 
"Plecoptera (Predator)"), class = "factor")), row.names = c(13802L, 
13874L, 71L, 4L, 14551L, 4956L, 5993L, 4921L, 779L, 887L), class = "data.frame")

CodePudding user response:

If you change the add to jitter you can change the shape like this:

library(ggpubr)
  ggerrorplot(subset_PUFA_together, x = "Lipid_Species", y = "isotopic_ratio",
              add = "jitter", error.plot = "errorbar", color = "combi", 
              palette = c( "#009E73","#E69F00","#F0E442",
                           "#0072B2", "#D55E00", "#CC79A7", "#000000"),
              legend = "right",position = position_dodge(width=0.4),
              size = 1.4, xlab = "", ylab = "", add.params=list(shape = "combi")) 

Output:

enter image description here

  • Related