bschneidr / selr

R functions to create interactive functionality in HTML documents using only client-side HTML and JavaScript
Other
3 stars 0 forks source link

Add `sel_plot` function #1

Open bschneidr opened 6 years ago

bschneidr commented 6 years ago

This function would ultimately have a result similar to sel_image() in that the resultant HTML/Javascript would cycle through base 64 images or image file references. However, when the user is working in RMarkdown, they would feed plot objects to the function, rather than feeding image file references.

plot_a <- qplot(x = Sepal.Length, y = Sepal.Width, data = iris)
plot_b <- qplot(x = mpg, y = wt, data = mtcars)
sel_plot(sel_id = "datasets",
         options = list(a = plot_a, b = plot_b),
         embed = TRUE)

As with sel_image(), the user can choose whether to have base-64 images or linked image files.

bschneidr commented 6 years ago

Will want to make sure that this works with a variety of plot objects, such as ggplot, base plots, gtable, etc.

bschneidr commented 6 years ago

Will also want to make sure that the function is aware of relevant knitr global and chunk options (e.g. fig.width) when generating images.

bschneidr commented 6 years ago

Still need to make the function work with non-ggplot2 plot objects.