l_layer_contourLines | R Documentation |
This function is a wrapper around
contourLines
that adds the countourlines to a loon
plot which is based on the cartesian coordinate system.
l_layer_contourLines(
widget,
x = seq(0, 1, length.out = nrow(z)),
y = seq(0, 1, length.out = ncol(z)),
z,
nlevels = 10,
levels = pretty(range(z, na.rm = TRUE), nlevels),
asSingleLayer = TRUE,
parent = "root",
index = "end",
...
)
widget |
widget path as a string or as an object handle |
x, y |
As described in |
z |
As described in |
nlevels |
As described in |
levels |
As described in |
asSingleLayer |
if |
parent |
a valid Tk parent widget path. When the parent widget is
specified (i.e. not |
index |
position among its siblings. valid values are 0, 1, 2, ..., 'end' |
... |
arguments forwarded to |
For more information run: l_help("learn_R_layer.html#countourlines-heatimage-rasterimage")
layer id of group or lines layer
if(interactive()){
p <- l_plot()
x <- 10*1:nrow(volcano)
y <- 10*1:ncol(volcano)
lcl <- l_layer_contourLines(p, x, y, volcano)
l_scaleto_world(p)
if (requireNamespace("MASS", quietly = TRUE)) {
p1 <- with(iris, l_plot(Sepal.Length~Sepal.Width, color=Species))
lcl <- with(iris, l_layer_contourLines(p1, MASS::kde2d(Sepal.Width,Sepal.Length)))
p2 <- with(iris, l_plot(Sepal.Length~Sepal.Width, color=Species))
layers <- sapply(split(cbind(iris, color=p2['color']), iris$Species), function(dat) {
kest <- with(dat, MASS::kde2d(Sepal.Width,Sepal.Length))
l_layer_contourLines(p2, kest, color=as.character(dat$color[1]), linewidth=2,
label=paste0(as.character(dat$Species[1]), " contours"))
})
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.