Add arbitrary expression to a label. The symbol that will be replace by the label value is .x.

math_format(expr = 10^.x, format = force)

## Arguments

expr expression to use another format function to apply prior to mathematical transformation - this makes it easier to use floating point numbers in mathematical expressions.

## Value

a function with single parameter x, a numeric vector, that returns a list of expressions

plotmath()

## Examples

math_format()(1:10)#> [[1]]
#> 10^1
#>
#> [[2]]
#> 10^2
#>
#> [[3]]
#> 10^3
#>
#> [[4]]
#> 10^4
#>
#> [[5]]
#> 10^5
#>
#> [[6]]
#> 10^6
#>
#> [[7]]
#> 10^7
#>
#> [[8]]
#> 10^8
#>
#> [[9]]
#> 10^9
#>
#> [[10]]
#> 10^10
#> math_format(alpha + frac(1, .x))(1:10)#> [[1]]
#> alpha + frac(1, 1)
#>
#> [[2]]
#> alpha + frac(1, 2)
#>
#> [[3]]
#> alpha + frac(1, 3)
#>
#> [[4]]
#> alpha + frac(1, 4)
#>
#> [[5]]
#> alpha + frac(1, 5)
#>
#> [[6]]
#> alpha + frac(1, 6)
#>
#> [[7]]
#> alpha + frac(1, 7)
#>
#> [[8]]
#> alpha + frac(1, 8)
#>
#> [[9]]
#> alpha + frac(1, 9)
#>
#> [[10]]
#> alpha + frac(1, 10)
#> math_format()(runif(10))#> [[1]]
#> 10^0.8882496
#>
#> [[2]]
#> 10^0.9963469
#>
#> [[3]]
#> 10^0.5001915
#>
#> [[4]]
#> 10^0.358967
#>
#> [[5]]
#> 10^0.774913
#>
#> [[6]]
#> 10^0.5844753
#>
#> [[7]]
#> 10^0.6339764
#>
#> [[8]]
#> 10^0.8586662
#>
#> [[9]]
#> 10^0.5668943
#>
#> [[10]]
#> 10^0.252997
#> math_format(format = percent)(runif(10))#> [[1]]
#> 10^91.9%
#>
#> [[2]]
#> 10^86.7%
#>
#> [[3]]
#> 10^24.9%
#>
#> [[4]]
#> 10^40.3%
#>
#> [[5]]
#> 10^77.0%
#>
#> [[6]]
#> 10^11.9%
#>
#> [[7]]
#> 10^19.5%
#>
#> [[8]]
#> 10^16.5%
#>
#> [[9]]
#> 10^66.3%
#>
#> [[10]]
#> 10^85.7%
#>