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 <- x^2

V <- c(28,14)

df <- data.frame(x=x,y=y)

ggplot(df,aes(x=x,y=y))+geom_line()+

    annotate("text",x=3,y=20,label=bquote(V ==.(as.vector(V))))

 

 

 

ggplot(df,aes(x=x,y=y))+geom_line()+

    annotate("text",x=3,y=20,label=expression(paste("V is ",V)))

 

 

ggplot(df,aes(x=x,y=y))+geom_line()+

    annotate("text",x=3,y=20,label=bquote(V ==.(V)))


This email has been scanned by BullGuard antivirus protection.
For more info visit www.bullguard.com
<http://www.bullguard.com/tracking.aspx?affiliate=bullguard&buyaffiliate=smt
p&url=/> 

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to