R - Plot: How to format in 10-base scientific notation and put it text, mtex, title etc functions? -
i have numeric variable, k=3.5e-5 (its values calculated throughout script). want write value somewhere (title, text in plot, etc) in plot as: k_{root} = 3.5 10^{-5} cm /d i have tried functions bquote , substitute , no 1 worked. let's put question in examples. have tried following: 1) png("exp_1.png") kroot = 3.5e-5 plot(1:10,1:10, text(4,9,bquote(italic(k[root])~"="~.(kroot)~"cm/d"))) dev.off() try favorite function, paste(). plot(1:10,1:10, text(4,9,gsub("e",paste("k[root]=",format(k,scientific=true),"cm/d",sep=" "),replacement=" 10^"))) you can replace "e" here using function gsub. i've edited answer include this. the output: > k=.0000035 > k [1] 3.5e-06 > gsub("e",paste("k[root]=",format(k,scientific=true),"} cm/d",sep=" "),replacement=" 10^{ ") [1] "k[root]= 3.5 10^{ -06 } cm/d"