faithful %>% ggvis(waiting,eruptions) %>% layer_points() %>% add_axis("x", title = "Waiting period", values = c(1,2,3,4,5,6,7), subdivide = 9)|
Mapping
|
Setting
|
= maps property to a data value |
:= sets property to a specific size/coluor/width |
|
Used for visualization of data
|
Used for customizing the appearance of plots
|
|
ggvis scales the values to a pre-defined scale of colour/sizes
|
ggvis sends the colour value to vega - a javascript package for further processing
|
fill,x, y, stroke, strokeWidth, strokeOpacity, fill, opacity, fillOpacity, shape, size
faithful %>% ggvis(waiting, eruptions, fillOpacity = ~eruptions, size := 100, fill := "red", stroke := "red", shape := "cross") %>% layer_points()x, y, fill, fillOpacity, opacity, stroke, strokeDash, strokeOpacity, and strokeWidth|
compute_smooth
|
compute_bin()
|
|
It transforms the data to generate a new dataframe.
|
It transforms the data to generate a new dataframe.
|
|
It returns a dataset with 2 variables, one named pred_ and the other resp_
|
It returns a dataset with 4 variables, x, x2 ,y ,y2.
|
mtcars %>% compute_smooth(mpg wt) %>% ggvis(pred_,resp_) %>% layer_lines()mtcars %>% ggvis(wt,mpg) %>% layer_smooths()faithful %>% compute_bin(waiting, width = 5) %>% ggvis(x = xmin_, x2 = xmax_, y = 0, y2 = count_) %>% layer_rects()faithful %>% ggvis(waiting) %>% layer_histograms(width = 5)
faithful %>% compute_density(waiting) %>% ggvis(pred_, resp_) %>% layer_lines()faithful %>% ggvis(waiting, fill := "green") %>% layer_densities()
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.