l_layer_rectangles | R Documentation |
Loon's displays that are based on Cartesian coordinates (i.e. scatterplot, histogram and graph display) allow for layering visual information including polygons, text and rectangles.
l_layer_rectangles(
widget,
x,
y,
color = "gray80",
linecolor = "black",
linewidth = 1,
label = "rectangles",
parent = "root",
index = 0,
group = NULL,
active = TRUE,
...
)
widget |
widget path name as a string |
x |
list with vectors with x coordinates |
y |
list with vectors with y coordinates |
color |
vector with fill colors, if empty string |
linecolor |
vector with outline colors |
linewidth |
vector with line widths |
label |
label used in the layers inspector |
parent |
group layer |
index |
of the newly added layer in its parent group |
group |
separate x vector or y vector into a list by group. |
active |
a logical determining whether objects appear or not
(default is |
... |
additional state initialization arguments, see
|
For more information run: l_help("learn_R_layer")
layer object handle, layer id
l_layer
, l_info_states
if(interactive()){
p <- l_plot()
l <- l_layer_rectangles(
p,
x = list(c(0,1), c(1,2), c(2,3), c(5,6)),
y = list(c(0,1), c(1,2), c(0,1), c(3,4)),
color = c('red', 'blue', 'green', 'orange'),
linecolor = "black"
)
l_scaleto_world(p)
l_info_states(l)
# Set groups
pp <- l_plot(x = c(0,1,1,2,2,3,5,6),
y = c(0,1,1,2,0,1,3,4))
# x and y are inherited from pp
ll <- l_layer_rectangles(
pp,
group = rep(1:4, each = 2),
color = c('red', 'blue', 'green', 'orange'),
linecolor = "black"
)
l_scaleto_world(pp)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.