user7170429
user7170429

Reputation:

italicizing the first letter but NOT the rest of the letters of a word in text() in R

I was wondering how I can plot the word "p-value" (just as shown here; i.e., letter "p" in italics and boldfaced but rest of the letters only bold-faced)?

I'm trying the following R code with no success:

plot(1:10, ty="n", ann=F)

text( 2.5, 9.5, bquote(bolditalic(p),bold(-value)), cex = 1.5)

Upvotes: 1

Views: 84

Answers (1)

edstatsuser
edstatsuser

Reputation: 220

Try pasting the 'p' and '-value' together within expression():

text( 2.5, 9.5, expression(paste(bolditalic("p"),bold("-value"))), cex = 1.5)

Upvotes: 2

Related Questions