Description Usage Arguments Value Examples
An analogue to curve() for functions of two variables. Functions can be visualized using heatmaps or 3D surfaces.
1 |
f |
Function to visualize. Must expect arguments named 'x' and 'y'. |
from.x |
Minimal value of 'x'. |
to.x |
Maximal value of 'x'. |
from.y |
Minimal value of 'y'. |
to.y |
Maximal value of 'y'. |
heatmap |
Boolean indicates whether or not to visualize function using a 3D surface or a heatmap. Defaults to FALSE. |
n |
How many points should f be evaluated at along each dimension? |
None. Called for side effects.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library('curve3D')
g <- function(x, y) {(1 + y * 2) ^ (-x / y) * (1 + y * 1) ^ (x / y)}
curve3D(g, from.x = 0.01, to.x = 1, from.y = 0.01, to.y = 1, heatmap = FALSE)
curve3D(g, from.x = 0.01, to.x = 1, from.y = 0.01, to.y = 1, heatmap = TRUE)
h <- function(x, y) {x ^ 2 + y ^ 2}
curve3D(h, from.x = 0.01, to.x = 1, from.y = 0.01, to.y = 1, heatmap = FALSE)
curve3D(h, from.x = 0.01, to.x = 1, from.y = 0.01, to.y = 1, heatmap = TRUE)
i <- function(x, y) {sin(x) + sin(y)}
curve3D(i, from.x = 1, to.x = 10, from.y = 1, to.y = 10, heatmap = FALSE)
curve3D(i, from.x = 1, to.x = 10, from.y = 1, to.y = 10, heatmap = TRUE)
j <- function(x, y) {x + y + x * y}
curve3D(j, from.x = 1, to.x = 10, from.y = 1, to.y = 10, heatmap = FALSE)
curve3D(j, from.x = 1, to.x = 10, from.y = 1, to.y = 10, heatmap = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.