mrjoh3 / c3

c3 HTMLWidget Ploting
39 stars 51 forks source link

c3 produces a blank plot when the dplyr tibble classes exist. #13

Closed Dulani closed 5 years ago

Dulani commented 5 years ago
iris_tibble <- iris %>%
    as_tibble()

iris_tibble %>%
  c3(x = 'Sepal_Length', 
     y = 'Sepal_Width', 
     group = 'Species') %>% 
  c3_line('line')

This results in a blank plot for me using RStudio 1.1.453 and R3.5.

If iris is plotted directly:

iris %>%
  c3(x = 'Sepal_Length', 
     y = 'Sepal_Width', 
     group = 'Species') %>% 
  c3_line('line')

then it works beautifully.

(This really is a beautiful plotting package).

mrjoh3 commented 5 years ago

Hi @Dulani, glad you like the package. It seams as_tibble converts iris$Species to a factor. This caused a problem with the way I was pulling out groups for the plots indexing. The fix was pretty simple but should ensure consistent behaviour for data.frame and tibbles. Please let me know if the behaviour continues at your end.