добавление текста в сюжет в указанном месте - PullRequest
0 голосов
/ 17 октября 2018

Я хочу добавить метки к каждой отдельной строке на графике ниже: enter image description here

a <- 1:2000
b <- a - a[1]

plot(1, type = "n", xlab = "Scale parameter", ylab = "No. of days", xlim = c(0, 90), ylim = c(0, 150))
shape.range <- seq(from = 2, to = 10, by = 1)
scale.range <- seq(from = 10, to = 70, by = 1)

for(sh in seq_along(shape.range)){

sh.ref <- shape.range[sh]

 for(sc in seq_along(scale.range)){

   sc.ref <- scale.range[sc]
   p <-  1 - exp(-(b/sc.ref)^sh.ref)
   p.l <- which.max(p >= 0.97)

   points(sc.ref,   p.l, cex = 0.5, pch = 19)
#  text(80, # how to insert the value of y here such that the label ends up at the end of the each line, labels = paste0(sh.ref))
  }
}

1 Ответ

0 голосов
/ 17 октября 2018

Не все должно быть в ggplots.Базовую графику иногда легче настроить.

Просто добавьте эти строки после кода.

text(20,100,"Text left")
text(60,20,"Text right")

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...