I'd like to be able to
This sounds pretty straightforward - my code is:
minx = minx = input_numeric(1, 'Min x-val')
maxx = input_numeric(1, 'Max x-val')
data.frame(train.dt) %>%
ggvis(x = ~plot_idx, y = ~val) %>%
layer_lines() %>% add_axis('x') %>%
scale_numeric('x', domain = c(minx, maxx), clamp = T)
However, this doesn't work. I get this error message:
"Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] : non-numeric argument to binary operator".
If I replace minx and maxx in the domain argument with e.g. 1 and 10, my graph plots just fine (but is static). Any ideas?
Thanks!
This may be helpful. Since there is no reproducible data, I decided to use an example from the CRAN manual. What you would have to do is to use input_slider
and choose min and max for the x-axis. In this example, you have a double-ended slider. That means you can choose/change min and max both. The input_slider
goes into domain in scale_numeric
.
# Set up input_slider
foo <- input_slider(1, 10, c(1, 6))
mtcars %>%
ggvis(x = ~wt, y = ~mpg, stroke = ~factor(cyl)) %>%
layer_lines() %>%
scale_numeric("x", domain = foo, clamp = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With