range {rbokeh} | R Documentation |
Update x and y axis range in a Bokeh figure
x_range(fig, lims = NULL, min_interval = NULL, max_interval = NULL, bounds = NULL, flipped = FALSE, range_padding = 0.07, range_padding_units = "percent", default_span = NULL, follow = NULL, follow_interval = NULL, callback = NULL, clear = FALSE) y_range(fig, lims = NULL, min_interval = NULL, max_interval = NULL, bounds = NULL, flipped = FALSE, range_padding = 0.07, range_padding_units = "percent", default_span = NULL, follow = NULL, follow_interval = NULL, callback = NULL, clear = FALSE)
fig |
Figure to modify. |
lims |
Either a vector (min, max) if the range is numeric, or a vector of values if the range is categorical. In the latter case, the order in which the values are supplied is how they will be arranged on the axis. |
min_interval |
The level that the range is allowed to zoom in. For numeric ranges, it is expressed as the minimum visible interval. For categorical ranges, it is expressed as the minimum number of visible categories. If set to |
max_interval |
The level that the range is allowed to zoom out. For numeric ranges, it is expressed as the maximum visible interval. For categorical ranges, it is expressed as the maximum number of visible categories. Note that |
bounds |
The bounds that the range is allowed to go to - typically used to prevent the user from panning/zooming/etc away from the data. By default, the bounds are |
flipped |
For numeric ranges only. Whether the range should be "flipped" from its normal direction when auto-ranging (boolean). |
range_padding |
For numeric ranges only. How much padding to add around the computed data bounds. When |
range_padding_units |
For numeric ranges only. Whether the |
default_span |
For numeric ranges only. A default width for the interval, in case |
follow |
For numeric ranges only. Configure the data to follow one or the other data extreme, with a maximum range size of |
follow_interval |
For numeric ranges only. If |
callback |
A string JavaScript code to be run any time the axis range is updated. |
clear |
A logical indicating whether all non-specified parameters should be cleared out of any exising specification in the figure. This can be useful when modifying a previously-defined figure. |
figure() %>% ly_points(sample(1:26), letters) %>% x_range(c(-5, 31), range_padding = 0) figure() %>% ly_points(sample(1:26), letters) %>% x_range(flipped = TRUE) figure() %>% ly_points(sample(1:26), letters) %>% y_range(rev(letters)) figure() %>% ly_points(sample(1:26), letters) %>% x_range(bounds = c(-5, 31)) figure() %>% ly_points(sample(1:26), letters) %>% x_range(min_interval = 10, max_interval = 40) figure() %>% ly_points(sample(1:26), letters) %>% y_range(min_interval = 10, max_interval = 40) figure() %>% ly_points(sample(1:26), letters) %>% x_range(c(-5, 31), follow = "start", follow_interval = 10) figure() %>% ly_points(sample(1:26), letters) %>% x_range(callback = "console.log(this.attributes.start)")