l_facet | R Documentation |
It takes a loon widget and forms a matrix of loon widget facets.
l_facet(widget, by, on, layout = c("grid", "wrap", "separate"), ...)
## S3 method for class 'loon'
l_facet(
widget,
by,
on,
layout = c("grid", "wrap", "separate"),
connectedScales = c("cross", "row", "column", "both", "x", "y", "none"),
linkingGroup,
nrow = NULL,
ncol = NULL,
inheritLayers = TRUE,
labelLocation = c("top", "right"),
labelBackground = "gray80",
labelForeground = "black",
labelBorderwidth = 2,
labelRelief = c("groove", "flat", "raised", "sunken", "ridge", "solid"),
plotWidth = 200,
plotHeight = 200,
parent = NULL,
...
)
## S3 method for class 'l_serialaxes'
l_facet(
widget,
by,
on,
layout = c("grid", "wrap", "separate"),
linkingGroup,
nrow = NULL,
ncol = NULL,
labelLocation = c("top", "right"),
labelBackground = "gray80",
labelForeground = "black",
labelBorderwidth = 2,
labelRelief = c("groove", "flat", "raised", "sunken", "ridge", "solid"),
plotWidth = 200,
plotHeight = 200,
parent = NULL,
...
)
widget |
A loon widget |
by |
loon plot can be separated by some variables into mutiple panels.
This argument can take a |
on |
if the |
layout |
layout facets as |
... |
named arguments to modify the 'loon' widget states |
connectedScales |
Determines how the scales of the facets are to be connected depending
on which
|
linkingGroup |
A linkingGroup for widgets. If missing, default would be a paste of "layout" and the current tk path number. |
nrow |
The number of layout rows |
ncol |
The number of layout columns |
inheritLayers |
Logical value. Should widget layers be inherited into layout panels? |
labelLocation |
Labels location.
|
labelBackground |
Label background colour |
labelForeground |
Label foreground colour |
labelBorderwidth |
Label border width |
labelRelief |
Label relief |
plotWidth |
default plot width (in pixels) |
plotHeight |
default plot height (in pixels) |
parent |
a valid Tk parent widget path. When the parent widget is
specified (i.e. not |
an 'l_facet' object (an 'l_compound' object), being a list with named elements, each representing a separate interactive plot. The names of the plots should be self explanatory and a list of all plots can be accessed from the 'l_facet' object via 'l_getPlots()'.
if(interactive()) {
library(maps)
p <- with(quakes, l_plot(long, lat, linkingGroup = "quakes"))
p["color"][quakes$mag < 5 & quakes$mag >= 4] <- "lightgreen"
p["color"][quakes$mag < 6 & quakes$mag >= 5] <- "lightblue"
p["color"][quakes$mag >= 6] <- "firebrick"
# A Fiji map
NZFijiMap <- map("world2", regions = c("New Zealand", "Fiji"), plot = FALSE)
l_layer(p, NZFijiMap,
label = "New Zealand and Fiji",
color = "forestgreen",
index = "end")
fp <- l_facet(p, by = "color", layout = "grid",
linkingGroup = "quakes")
size <- c(rep(50, 2), rep(25, 2), rep(50, 2))
color <- c(rep("red", 3), rep("green", 3))
p <- l_plot(x = 1:6, y = 1:6,
size = size,
color = color)
g <- l_glyph_add_text(p, text = 1:6)
p['glyph'] <- g
on <- data.frame(Factor1 = c(rep("A", 3), rep("B", 3)),
Factor2 = rep(c("C", "D"), 3))
cbind(on, size = size, color = color)
fp <- l_facet(p, by = Factor1 ~ Factor2, on = on)
}
if(interactive()) {
# serialaxes facets
s <- l_serialaxes(iris[, -5], color = iris$Species)
fs <- l_facet(s, layout = "wrap", by = iris$Species)
# The linkingGroup can be printed or accessed by
l_configure(s, linkingGroup = fs[[1]]['linkingGroup'], sync = "pull")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.