Learn R Programming

emdbook (version 1.3.2.1)

scinot: Scientific notation as LaTeX/expression()

Description

Takes a number and returns a version formatted in LaTeX (suitable for use with Sexpr() in an Sweave document) or in expression() (suitable for plotting), or plots an axis with labels in scientific notation

Usage

scinot(x, format = c("latex", "expression"), delim="$",
pref="", ...)
axis.scinot(side,at)

Arguments

x
a numeric vector (of length 1)
format
produce LaTeX or expression() format?
delim
delimiter to add at beginning and end (latex only)
pref
text to put before expression (expression only)
side
side on which to plot axis
at
list of locations/labels
...
additional arguments to formatC

Value

  • a character vector (if latex) or expression (if expression); axis.scinot draws an axis on the current plot

See Also

formatC, expression, plotmath, axis, axTicks, latexSN in the Hmisc package, eaxis in the sfsmisc package

Examples

Run this code
scinot(1e-5)
scinot(1e-5,digits=0)
scinot(1e-5,"expression")
scinot(1e-5,"expression",pref="p=")
set.seed(1001)
plot(1:100,rlnorm(100,0,2),log="y",axes=FALSE)
axis(side=1)
axis.scinot(side=2)  ## fix bug!

Run the code above in your browser using DataLab