How to change legend position of ggvis when using

2019-08-14 04:58发布

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?

标签: r ggvis
1条回答
Summer. ? 凉城
2楼-- · 2019-08-14 05:20

This is a know issue, you can try adding the below at the end of your code as a workaround:

... %>% set_options(duration = 0)
查看更多
登录 后发表回答