0

I performed a t-test and its p-value suggested the difference between results is significant. I would like to visualize this using stars on ggplot.

That's how my data looks like:

> dput(DF_tot)
structure(list(Names = c("Mark", "Nate", "Stuart"), 
               Area = c(5.125, 176.115, 7.44), 
               SD = c(1.87, 3.14, 5.151)), 
          row.names = 4:6, class = "data.frame")

That's a code I use to create ggplot:

p <- ggplot(DF_tot, aes(x=Names, y=Area, fill=Names)) + 
  geom_bar(stat="identity", fill="gray12", position=position_dodge()) +
  geom_errorbar(aes(ymin=Area-SD, ymax=Area+SD), width=.2,
                position=position_dodge(.9)) 

p + 
  theme_bw() + 
  theme(panel.border = element_blank(), 
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(), 
        axis.line = element_line(colour = "black")) +
  labs(x = "", y = "")+
  theme(axis.text=element_text(size=13))

Below I show what I would like to achieve:

Example

Of course such line and stars should also go to the bar on the left side. It would be great if I can easily modify number of stars.

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
Rechlay
  • 1,457
  • 2
  • 12
  • 19
  • There are different solutions proposed [here](https://stackoverflow.com/questions/17084566/put-stars-on-ggplot-barplots-and-boxplots-to-indicate-the-level-of-significanc), is that what you are looking for? – Nausi Sep 10 '20 at 08:44
  • Possible duplicate https://stackoverflow.com/a/27073333/680068 – zx8754 Sep 10 '20 at 08:49

0 Answers0