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
|
layer object handle, layer id
For more information run: l_help("learn_R_layer")
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) }