Description Usage Arguments Examples
View source: R/handle_resize.R
Handlers and interactive inputs for plot sizing.
1 2 3 4 5 | handle_resize(vis, on_resize)
plot_width(vis)
plot_height(vis)
|
vis |
Visualisation to listen to. |
on_resize |
Callback function with arguments:
|
1 2 3 4 5 6 7 8 9 | # This example just prints out the current dimensions to the console
mtcars %>% ggvis(~mpg, ~wt) %>%
layer_points() %>%
handle_resize(function(width, height, ...) cat(width, "x", height, "\n"))
# Use plot_width() and plot_height() to dynamically get the plot size
# inside the plot.
mtcars %>% ggvis(~mpg, ~wt) %>% layer_text(text := plot_width())
mtcars %>% ggvis(~mpg, ~wt) %>% layer_text(text := plot_height())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.