This thread shows how to change the position of the legend in a ggvis object. However, if tooltips are added as well, the legend disappears.
library(ggvis)
data(mtcars)
mtcars %>%
ggvis(x = ~wt, y = ~mpg, fill = ~cyl) %>%
layer_points() %>%
add_legend(
"fill",
properties = legend_props(
legend = list(
x = scaled_value("x", 3.25),
y = scaled_value("y", 40)
)
)
) %>%
add_tooltip(function(df) df$wt)
Any idea how to prevent this?
This is a know issue, you can try adding the below at the end of your code as a workaround: