hafen / trelliscopejs

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

Failed histogram breaks calculation #56

Closed beansrowning closed 6 years ago

beansrowning commented 6 years ago

What was done :

Addresses #55

This is a simple fix to avoid proceeding into the if closure for cases where there would be only one value greater than 0, causing an error when attempting to generate a histogram.

Build is successful on both my work and local systems: Win 10 x64 R 3.4.1 and Win 7 x64 R 3.4.3

I tried trelliscope() on both the reproducible example provided by @ataustin and a much larger project (~30 displays, many thousands of panels). Both rendered successfully without error.

For reference, this is the example I tried:

library(ggplot2)
library(tidyr)
library(dplyr)
library(trelliscopejs)

df <- data.frame(group = letters[1:10],
                 val1  = rep(c(0, 0.9), times = c(9, 1))
                 )

df %>%
  group_by(group) %>%
  nest(.key = "data") %>%
  mutate(panel = map_plot(data, function(x) ggplot(x, aes(val1)) + geom_histogram())) %>%
  trelliscope(name = "test",
              path = "output")

Notes :

hafen commented 6 years ago

Many thanks! Looks great.

ataustin commented 6 years ago

:100: :100: :100: thanks y'all!