0

I've been using ggvis to visualise data containing 3 factors. Unfortunately, if I use fill and stroke on data I've been filtering, then adding the shape condition to the layer_points leads to the shape being added underneath the coloured circular point, like this:

enter image description here

The relevant section of the code that controls this is here:

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))) %>%

Does anyone know how I can modify the actual coloured points themselves rather than adding an additional shape? I've tried to do something similar to one of the examples in the documentation like this:

mtcars2 %>% ggvis(~mpg, ~wt, size = ~cyl, fill = ~cyl) %>% layer_points() %>%
add_legend(c("size", "fill"))

However, this results in a legend being added to the plot with a title I'm unable to modify.

Jack Simpson
  • 1,681
  • 3
  • 30
  • 54
  • 1
    Can you make your example [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? You are currently drawing three points because of the three calls to `layer_points`. What is wrong exactly with your `mtcars2` example? Can't you use the `title` argument in there? – Axeman Nov 30 '15 at 13:41
  • 1
    Your point about me "drawing three points" helped me solve it - I just merged all the prop functions into a single layer_points and it solved the issue. Thanks so much! – Jack Simpson Dec 01 '15 at 01:02

0 Answers0