The visualization displays a uniform array of points and their images under the function defined
by the model as dots. Multiple
iterations of the function may be visualized.
In order to use this visualization, a discretization parameter must be provided in either the
range or to the dsdots
object.
dsdots(col = "black", image = "", iters = 1, discretize = NULL, crop = TRUE, size = 0.37, behind = TRUE, ...)
col | A string specifying the color of the initial discretized points. |
---|---|
image | Sets the color of the final image of the discretized points. See details. |
iters | Determines the number of iterations of the function when making a color gradient.
Use |
discretize | Overrides the discretization parameter defined in the range. |
crop | If |
size | Determines the display size of each dot. |
behind | Sets the dots as a background object for layering purposes. |
... | Extra graphical parameters |
The col
parameter defines the color of the initial, discretized, points.
There are three modes of operation.
If the image
parameter
parameter is a single color, and iters
is not set, then the image of each point is displayed as a
dot of color image
.
Alternately, image
can be set as a vector of colors (for example: image =
c("red", "NA", "green")
). In this case the function is applied iteratively to the points a
number of times equal to the length of the vector. The initial points are displayed using
col
. Each iteration is displayed by the
corresponding color. "NA"
may be used to not display that iteration.
to specify the number of iterations of the function to apply.
Finally, if iters is set to a numeric value greater than 1, a color gradient is used to display
iterations. In this case both
col
and image
should be single colors. The function is applied iters
time,
with each iteration being colored along the gradient from col
to image
.
In most cases, rather than specifying col
and image
separately, they may be
combined into a single vector.
library(dsmodels) fun <- function(X,Y) { list( X/exp(Y), Y/exp(X) ) } model <- dsmodel(fun, title = "View of the Discretized Field") range <- dsrange(-2:2,-2:2, discretize = 0.09) # To view the discretized field, simply add dsdots() to your model model + range + dsdots()# To view a gradient with a certain amount of iterations, # specify the image and the amount of iterations in the image # and iters parameters, respectively. dsmodel(fun, title = "Gradient of Iterations from Blue to Red") + dsrange(-2:2,-2:2, discretize = 0.09) + dsdots(col = "blue", image = "red", iters = 3)