hafen / trelliscopejs

TrelliscopeJS R Package
https://hafen.github.io/trelliscopejs
Other
262 stars 36 forks source link

The use of the folder button #84

Closed JauntyJJS closed 4 years ago

JauntyJJS commented 4 years ago

Hi,

I apologize in advanced for asking a naive question

In the webpage, https://cran.r-project.org/web/packages/autocogs/readme/README.html

There is this blue folder created beside the exclamation help button.

image

May I ask what is that and how do I create this folder in this R package ?

Thank you for the clarification

hafen commented 4 years ago

The folder button is activated when you have more than one display in a directory. If you create more than one display with the same path argument, but with different names, the icon will appear and you will be able to switch between the different displays.

JauntyJJS commented 4 years ago

Thank you for the help. I manage to get the folder to appear when I key in the following code

library(ggplot2)
library(dplyr)
library(tidyr)
library(gapminder)
library(plotly)
library(trelliscopejs)

scatter <- function(d){

  p <- plot_ly(data = d , x = ~lifeExp, y = ~year, type = 'scatter',mode ="markers")
  return(p)

}

gapminder %>%
  group_by(country, continent) %>%
  nest() %>%
  mutate(panel = map_plot(data,scatter)) %>%
  trelliscope(name = "gapminder_lifeexp",path="./out", nrow = 2, ncol = 6, self_contained = FALSE)

gapminder %>%
  group_by(country, continent) %>%
  nest() %>%
  mutate(panel = map_plot(data,scatter)) %>%
  trelliscope(name = "gapminder_lifeexp2",path="./out", nrow = 2, ncol = 6, self_contained = FALSE)

image

However, when I set self_contained = TRUE, instead

image

Clicking on the black button gives me a blank screen instead

image

Not sure if this is a known issue already.

hafen commented 4 years ago

self_contained = TRUE is meant only for a single display. Multiple displays only work when stored in a directory, which inherently makes them not self-contained. This probably isn't documented well enough, and I should probably add something that warns you about self-contained when specifying a path that already contains other displays.