l_layer_rectangles: Layer rectangles

View source: R/l_layer.R

l_layer_rectanglesR Documentation

Layer rectangles

Description

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.

Usage

l_layer_rectangles(
  widget,
  x,
  y,
  color = "gray80",
  linecolor = "black",
  linewidth = 1,
  label = "rectangles",
  parent = "root",
  index = 0,
  group = NULL,
  active = TRUE,
  ...
)

Arguments

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 "", then the fill is transparant

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 TRUE for all).

...

additional state initialization arguments, see l_info_states

Details

For more information run: l_help("learn_R_layer")

Value

layer object handle, layer id

See Also

l_layer, l_info_states

Examples

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)

}

loon documentation built on July 9, 2023, 5:48 p.m.