Thanks a lot for the interesting possibilities - R is wonderful!
BW
Troels
-Oprindelig meddelelse-
Fra: Rui Barradas
Sendt: 16. december 2019 19:31
Til: Troels Ring ; r-help mailing list
Emne: Re: [R] variable in annotation, ggplot2
Another way:
expr <- substitute(V == x, lis
Another way:
expr <- substitute(V == x, list(x = as.list(V)))
ggplot(df, aes(x, y)) + geom_line() +
annotate("text", x = 3, y = 20,
label = deparse(expr), parse = TRUE)
Or this one (nothing to do with your use case, it's an example of plotmath):
v <- paste("atop(", paste0("'V ='*a
Hello,
If you form the label with paste before the plot, it can display both
values. Something like
lab <- paste("V = ", paste(V, collapse = ","))
ggplot(df,aes(x=x,y=y)) + geom_line() +
annotate("text", x = 3, y = 20, label = lab)
Hope this helps,
Rui Barradas
Às 14:55 de 16/12/19, Tr
Hi friends - I have a simple problem of inserting values in label of a
ggplot2. I have a vector V with two values and want to show them in the
plot.
Here is what I tried - at most get the first entry "28".
R version 3.6.1 (2019-07-05)
Windows 10
BW
Troels
library(ggplot2)
x <- 1:5
y <
4 matches
Mail list logo