Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotmath3d

Draw text using base graphics math plotting


Description

To plot mathematical text, this function uses base graphics functions to plot it to a ‘.png’ file, then uses that file as a texture in a sprite.

Usage

plotmath3d(x, y = NULL, z = NULL, text, cex = par("cex"), adj = par("adj"), 
           pos = NULL, offset = 0.5,
           fixedSize = TRUE, startsize = 480, initCex = 5, ...)

Arguments

x, y, z

coordinates. Any reasonable way of defining the coordinates is acceptable. See the function xyz.coords for details.

text

A character vector or expression. See plotmath for how expressions are interpreted.

cex

Character size expansion.

adj

one value specifying the horizontal adjustment, or two, specifying horizontal and vertical adjustment respectively.

pos, offset

alternate way to specify adj; see text3d

fixedSize

Should the resulting sprite behave like the default ones, and resize with the scene, or like text, and stay at a fixed size?

startsize, initCex

These parameters are unlikely to be needed by users. startsize is an over-estimate of the size (in pixels) of the largest expression. Increase this if large expressions are cut off. initCex is the size of text used to form the bitmap. Increase this if letters look too blurry at the desired size.

...

Additional arguments to pass to text when drawing the text.

Value

Called for the side effect of displaying the sprites. The shape ID of the displayed object is returned.

Note

The text3d function passes calls to this function if its usePlotmath argument is TRUE. The default value is determined by examining its texts argument; if it looks like an expression, plotmath3d is used.

Author(s)

Duncan Murdoch

See Also

Examples

open3d()
plotmath3d(1:3, 1:3, 1:3, expression(x[1] == 1, x[2] == 2, x[3] == 3))
# This lets the text resize with the plot
text3d(4, 4, 4, "resizeable text", usePlotmath = TRUE, fixedSize = FALSE)

rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.