linked_brush: Create a linked brush object.

Description Usage Arguments Value Note Examples

View source: R/linked_brush.R

Description

A linked brush has two sides: input and output

Usage

1
linked_brush(keys, fill = "red")

Arguments

keys

vector of all possible keys, if known.

fill

brush colour

Value

A list with components:

input

A function that takes a visualisation as an argument and adds an input brush to that plot

selected

A reactive providing a logical vector that describes which points are under the brush

fill

A reactive that gives the fill colour of points under the brush

Note

linked_brush is very new and is likely to change substantially in the future

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lb <- linked_brush(keys = 1:nrow(mtcars), "red")

# Change the colour of the points
mtcars %>%
 ggvis(~disp, ~mpg) %>%
 layer_points(fill := lb$fill, size.brush := 400) %>%
 lb$input()

# Display one layer with all points and another layer with selected points
library(shiny)
mtcars %>%
 ggvis(~disp, ~mpg) %>%
 layer_points(size.brush := 400) %>%
 lb$input() %>%
 layer_points(fill := "red", data = reactive(mtcars[lb$selected(), ]))

rpruim/ggvis2 documentation built on May 28, 2019, 2:34 a.m.