rbokeh
rbokeh copied to clipboard
combining aesthetics with different variables doesn't work
I have some issue when combining different aesthetics in ly_points. Creating a plot for each aesthetic works, but creating a plot combining different variables for the color, glyph and size returns some warnings and a error:
# test data
df <- data.frame(x = rnorm(10), y = rnorm(10),
color = rep(rnorm(3), length.out = 10),
pch = sample(1:3, 10, replace = TRUE),
size = rnorm(10))
# one plot per aesthetic
figure() %>% ly_points(data = df, x = x, y = y, size = size)
figure() %>% ly_points(data = df, x = x, y = y, color = color)
figure() %>% ly_points(data = df, x = x, y = y, glyph = pch)
# one plot combining aesthetic, each one with a different variable
figure() %>% ly_points(data = df, x = x, y = y, size = size, color = color, glyph = pch)
Warning in min(x, na.rm = na.rm) :
no non-missing arguments to min; returning Inf
Warning in max(x, na.rm = na.rm) :
no non-missing arguments to max; returning -Inf
Warning in min(x, na.rm = na.rm) :
no non-missing arguments to min; returning Inf
Warning in max(x, na.rm = na.rm) :
no non-missing arguments to max; returning -Inf
note - arguments not used: fill_color, fill_alpha
Warning in min(x, na.rm = na.rm) :
no non-missing arguments to min; returning Inf
Warning in max(x, na.rm = na.rm) :
no non-missing arguments to max; returning -Inf
Error in get_theme_value(map_item$domain, cur_dat, attr) :
attempt to apply non-function
I have just tried with the development version: 0.2.4.1, and I don't have this error anymore. The multiple legends seems now to work for the color and the size, but I noticed two bugs:
- the symbols in the legend have the same size for the size parameter
- there is currently no legend for the shape
I have used the same code as previously:
# test data
df <- data.frame(x = rnorm(10), y = rnorm(10), color = rep(rnorm(3), length.out = 10), pch = sample(1:3, 10, replace = TRUE), size = rnorm(10))
# one plot combining aesthetic, each one with a different variable
figure() %>% ly_points(data = df, x = x, y = y, size = size, color = color, glyph = pch)
Session info: rbokeh_0.2.4.1 and htmlwidgets_0.5.1
Many thanks for the work done in the package, it seems to be a very promising package for interactive graphics in R!
Thanks for the report and your patience. Unfortunately the size issue is a current Bokeh limitation (see here and feel free to comment on it: https://github.com/bokeh/bokeh/issues/2603). The other issue is indeed not how things should behave and I'll use this as a test case for some ongoing work along these lines.