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)
}
Run the code above in your browser using DataLab