Let\'s say I have two floats
a <- 8.9384920e-24
b <- 0.00293892837
I would like to display either of them in 10-base scientific notation
You may check eaxis
in package sfsmisc
# some data
x <- seq(1, 100000, len = 10)
y <- seq(1e-5, 1e-4, len = 10)
# default axes
plot(x, y)
# eaxis
plot(x, y, axes = FALSE)
eaxis(side = 1)
eaxis(side = 2)
You may also create a label expression
using pretty10exp()
from the same package. For example to apply the format to a plot title:
plot(x, y, axes = FALSE)
title(pretty10exp(y[1]))