Description Usage Arguments Details Value See Also Examples
View source: R/USelection_movie.R
A movie to illustrate the effects of the transformation of variable(s) on the appearance of a scatter plot, using the 2000 U.S. Presidential Election data from Florida.
1 2 | scatterplot_movie(x, y, delta_power = 0.1, pos = 1,
envir = as.environment(pos), ...)
|
x, y |
Numeric vectors of the same length. Pairs of values to plot
using a scatter plot. The values in |
delta_power |
A numeric scalar. The amount by which the powers of
|
pos |
A numeric integer. Used in calls to |
envir |
An alternative way (to |
... |
Further arguments to be passed to |
scatterplot_movie
produces a scatter plot of the input
variables x
and y
which can then be animated by
transforming x
and/or y
using power transformations.
[In fact a
Box-Cox transformation
is used.]
The power of x
and y
is chosen using a parameter windows
containing buttons labelled + and -.
Clicking + increases the power by delta_power
and
clicking - decreases the power by delta_power
.
Nothing is returned, only the animation is produced.
movies
: general information about the movies.
USelection
: description of the 2000 U.S.
Presidential Election data from Florida.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Load package rpanel
# [Use install.packages("rpanel") if necessary]
library(rpanel)
# Proportion of votes gained by Buchanan
pbuch <- 100 * USelection$buch / USelection$tvot
# Produce plot
## Not run:
scatterplot_movie(x = USelection$npop, y = pbuch)
# Change the plotting character
scatterplot_movie(x = USelection$npop, y = pbuch, pch = 16)
## End(Not run)
# Identify Palm Beach using a different plotting character
county_name <- USelection[, "co_names"]
pb <- which(county_name == "PalmBeach")
my_pch <- rep(16, length(county_name))
my_pch[pb] <- 4
## Not run:
scatterplot_movie(x = USelection$npop, y = pbuch, pch = my_pch)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.