5

I have plotted box plot for my data using given command and trying to write text (p-value ) in it.

Using :

boxplot(data,ylab = prop_index[i])
text(1:2 - 0.4, data[,1]/2, paste("p-value=",p_val)) 

I applied "text" command but noting has appeared on image. Please tell me appropriate method to apply this command

Box plots are given

HubertL
  • 19,246
  • 3
  • 32
  • 51
user96368
  • 83
  • 1
  • 1
  • 7

1 Answers1

14
x1 <- rnorm(500)
y1 <- sample(c("a", "b", "c"), 500, replace=T)
boxplot(x1 ~ y1)
text(x= 1, y= 3, labels= "some text")
text(x= 2, y= 3, labels= "more \n text")
text(x= 3, y= 3, labels= "red text", col= "red")

enter image description here

alexwhitworth
  • 4,839
  • 5
  • 32
  • 59