James
James

Reputation: 157

How do i get the 2.5 to be subscript without changing the output of the brackets? ggplot axis labels

I have the following code for the y axis label in ggplot

y = bquote('PM2.5 ('*µg~m^-3*')')

I want the 2.5 to be subscript but can't figure out how whilst also keeping the part in the brackets how I want it.

I want the output in R on the y axis label to look like this:

enter image description here

Upvotes: 0

Views: 237

Answers (1)

akrun
akrun

Reputation: 887118

We may use

plot(1, 1, main = bquote('PM'[2.5]~'('*µg~m^-3*')'))

-output

enter image description here

Upvotes: 1

Related Questions