l_layer_lines: Layer lines

View source: R/l_layer.R

l_layer_linesR Documentation

Layer lines

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_lines(
  widget,
  x,
  y,
  color = "black",
  linewidth = 1,
  label = "lines",
  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

color of lines

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()){

s <- Filter(function(df)nrow(df) > 1, split(UsAndThem, UsAndThem$Country))
sUaT <- Map(function(country){country[order(country$Year),]} , s)
xcoords <- Map(function(x)x$Year, sUaT)
ycoords <- Map(function(x)x$LifeExpectancy, sUaT)
region <- sapply(sUaT, function(x)as.character(x$Geographic.Region[1]))

p <- l_plot(showItemLabels=TRUE)
l <- l_layer_lines(p, xcoords, ycoords, itemLabel=names(sUaT), color=region)
l_scaleto_layer(l)

# Set groups
p <- l_plot(showItemLabels=TRUE)
l <- l_layer_lines(p,
                   x = c((0:4)/10, rep(.5, 5), (10:6)/10, rep(.5, 5)),
                   y = c(rep(.5, 5), (10:6/10), rep(.5, 5), (0:4)/10),
                   group = rep(1:5, 4),
                   linewidth = 4,
                   col = l_getColorList()[1:5])
l_scaleto_layer(l)

}

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