Adds a visualization of the system using dots.

Description

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.

Usage

1
2
dsdots(col = "black", image = "", iters = 1, discretize = NULL,
  crop = TRUE, size = 0.37, behind = TRUE, ...)

Arguments

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 col = color1, image = color2, iters = n to create a gradient of colors between color1 and color2. See details for more information.

discretize

Overrides the discretization parameter defined in the range.

crop

If crop==TRUE, remove points found outside of the range from being rendered and iterated upon.

size

Determines the display size of each dot.

behind

Sets the dots as a background object for layering purposes.

...

Extra graphical parameters

Details

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.

See Also

dsarrows

dspoint

Examples

 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
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)

# Set color to "NA" if you wish for the specified iteration to not
# appear in the image
dsmodel(fun, title = "Display Only the Third Iteration") +
   dsrange(-2:2,-2:2, discretize = 0.09) +
   dsdots(col = "NA", image = c("NA","blue"), size = 1)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.