Description Usage Arguments Examples
View source: R/display-groupxy.r
This function is designed to allow comparisons across multiple groups, especially for examining things like two (or more) different models on the same data. The primary display is a scatterplot, with lines or contours overlaid.
1 2 3 4 5 | display_groupxy(center = TRUE, axes = "center", half_range = NULL,
col = "black", pch = 20, edges = NULL, group_by = NULL,
plot_gps = "all", plot_xgp = TRUE, gp_legend = TRUE, ...)
animate_groupxy(data, tour_path = grand_tour(), ...)
|
center |
if TRUE, centers projected data to (0,0). This pins the center of data cloud and make it easier to focus on the changing shape rather than position. |
axes |
position of the axes: center, bottomleft or off |
half_range |
half range to use when calculating limits of projected. If not set, defaults to maximum distance from origin to each row of data. |
col |
color to be plotted. Defaults to "black". |
pch |
shape of the point to be plotted. Defaults to 20. |
edges |
A two column integer matrix giving indices of ends of lines. |
group_by |
variable to group by. Must have less than 25 unique values. |
plot_gps |
vector of unique levels of the group_by variable to plot. |
plot_xgp |
if TRUE, plots points from other groups in light grey. |
gp_legend |
if TRUE, adds a legend of the group at the top left. |
... |
other arguments passed on to |
data |
matrix, or data frame containing numeric columns |
tour_path |
tour path generator, defaults to 2d grand tour |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | animate_groupxy(flea[, 1:6])
animate(flea[, 1:6], tour_path=grand_tour(), display=display_groupxy())
animate(flea[, 1:6], tour_path=grand_tour(),
display=display_groupxy(half_range = 0.5))
animate_groupxy(flea[, 1:6], tour_path=little_tour())
animate_groupxy(flea[, 1:3], tour_path=guided_tour(holes), sphere = TRUE)
animate_groupxy(flea[, 1:6], center = FALSE)
# The default axes are centered, like a biplot, but there are other options
animate_groupxy(flea[, 1:6], axes = "off")
animate_groupxy(flea[, 1:6], dependence_tour(c(1, 2, 1, 2, 1, 2)) )
# Adding color and group
require(colorspace)
pal <- rainbow_hcl(length(levels(flea$species)))
col <- pal[as.numeric(flea$species)]
gp = flea$species
animate_groupxy(flea[,-7], col=col, group_by=gp)
# You can also draw lines
edges <- matrix(c(1:5, 2:6), ncol = 2)
animate(flea[, 1:6], grand_tour(),
display_groupxy(axes="bottomleft", edges=edges, group_by=gp, col=col))
# Point characters, plotting other groups, and plotting legends
pch <- as.numeric(flea$species)+14
animate_groupxy(flea[, 1:6], col = col, pch = pch, group_by = gp)
animate_groupxy(flea[, 1:6], col = col, pch = pch, group_by = gp, plot_xgp = FALSE)
animate_groupxy(flea[, 1:6], col = col, pch = pch, group_by = gp, gp_legend = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.