cran / multipanelfigure

:exclamation: This is a read-only mirror of the CRAN R package repository. multipanelfigure — Infrastructure to Assemble Multi-Panel Figures (from Grobs)
3 stars 1 forks source link

Feature request: ggiraph support #1

Open instantkaffee opened 7 years ago

instantkaffee commented 7 years ago

It would be wonderfull to be able to multipanel ggiraph plots. Right now seems not supported.

library(multipanelfigure)
library(tidyverse)
library(ggiraph)

dataset = iris
dataset$tooltip = dataset$Species
dataset$clickjs = paste0("alert(\"",dataset$Species, "\")" )
gg_point = ggplot(dataset, aes(x = Sepal.Length, y = Petal.Width,
                               color = Species, tooltip = tooltip, onclick = clickjs) ) +
  geom_point_interactive()

gi= ggiraph(code = {print(gg_point)})

figure= multi_panel_figure(
  columns = 2,
  rows = 2,
  #figure_name = "figure1",
  panel_label_type = "none")

figure %<>% 
  fill_panel(gi) %<>% 
  fill_panel(gi) %<>% 
  fill_panel(gi) %<>% 
  fill_panel(gi)

print(figure)