我一直在使用ggvis来显示包含3个因素的数据。不幸的是,如果我在数据上使用填充和描边我已经过滤,那么将形状条件添加到layer_points会导致在彩色圆点下面添加形状,如下所示:
控制此代码的相关部分位于:
layer_points(prop("shape", as.name(all_factors[1]))) %>%
layer_points(prop("stroke", as.name(all_factors[2])), strokeWidth := input_slider(1, 5, label = "Stroke Width"), opacity := input_slider(0, 1, label = "Opacity")) %>%
layer_points(prop("fill", as.name(all_factors[3])), size := input_slider(10, 100, label = "Point Size"), opacity := input_slider(0, 1, label = "Opacity")) %>%
add_legend(scales = "shape", properties = legend_props(legend = list(y = 0))) %>%
add_legend(scales = "fill", properties = legend_props(legend = list(y = 100))) %>%
add_legend(scales = "stroke", properties = legend_props(legend = list(y = 350))) %>%
有谁知道如何修改实际的彩色点而不是添加额外的形状?我试图做类似文档中的一个示例,如下所示:
mtcars2 %>% ggvis(~mpg, ~wt, size = ~cyl, fill = ~cyl) %>% layer_points() %>%
add_legend(c("size", "fill"))
但是,这会导致图例中添加了标题,标题为“我无法修改”。