slider: Create a slider control

Description Usage Arguments Value See Also Examples

View source: R/manipulate.R

Description

Create a slider control to allow manipulation of a plot variable along a numeric range.

Usage

1
2
slider(min, max, initial = min,
       label = NULL, step = NULL, ticks = TRUE)

Arguments

min

Minimum value for slider.

max

Maximum value for slider.

initial

Initial value for slider. Defaults to min if not specified.

label

Display label for slider. Defaults to the variable name if not specified.

step

Step value for slider. If not specified then defaults to 1 for integer ranges and single pixel granularity for floating point ranges (max - min divided by the number of pixels in the slider).

ticks

Show tick marks on the slider. Note that if the granularity of the step value is very low (more than 25 ticks would be shown) then ticks are automatically turned off.

Value

An object of class "manipulator.slider" which can be passed to the manipulate function.

See Also

manipulate, picker, checkbox, button

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
## Not run: 

## Create a plot with a slider
manipulate(plot(1:x), x = slider(5, 10))

## Use multiple sliders
manipulate(
  plot(cars, xlim = c(x.min, x.max)),
  x.min = slider(0,15),
  x.max = slider(15,30))

## Specify a custom initial value for a slider
manipulate(
  barplot(1:x),
  x = slider(5, 25, initial = 10))

## Specify a custom label for a slider
manipulate(
  barplot(1:x),
  x = slider(5, 25, label = "Limit"))

## Specify a step value for a slider
manipulate(
  barplot(1:x),
  x = slider(5, 25, step = 5))

## End(Not run)

manipulate documentation built on May 2, 2019, 3:27 a.m.