l_layer_polygons {loon}R Documentation

Layer polygons

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_polygons(
  widget,
  x,
  y,
  color = "gray80",
  linecolor = "black",
  linewidth = 1,
  label = "polygons",
  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_polygons(
     p,
     x = list(c(1,2,1.5), c(3,4,6,5,2), c(1,3,5,3)),
     y = list(c(1,1,2), c(1,1.5,1,4,2), c(3,5,6,4)),
     color = c('red', 'green', 'blue'),
     linecolor = ""
)
l_scaleto_world(p)

l_info_states(l, "color")


# Set groups
p <- l_plot()
l_layer_polygons(p,
                 x = c(1, 2, 1.5, 3, 4, 6, 5, 2, 1, 3, 5, 3),
                 y = c(1, 1, 2, 1, 1.5, 1, 4, 2, 3, 5, 6, 4),
                 group = c(rep(1,3), rep(2,5), rep(3, 4)))
l_scaleto_world(p)

}

[Package loon version 1.4.1 Index]