layer_histograms {ggvis} | R Documentation |
Display binned data
layer_histograms(vis, ..., width = NULL, center = NULL, boundary = NULL, closed = c("right", "left"), stack = TRUE, binwidth) layer_freqpolys(vis, ..., width = NULL, center = NULL, boundary = NULL, closed = c("right", "left"), binwidth)
vis |
Visualisation to modify |
... |
Visual properties used to override defaults. |
width |
The width of the bins. The default is |
center |
The center of one of the bins. Note that if center is above or
below the range of the data, things will be shifted by an appropriate
number of |
boundary |
A boundary between two bins. As with |
closed |
One of |
stack |
If |
binwidth |
Deprecated; use |
layer_bars
For bar graphs of counts at each unique
x value, in contrast to a histogram's bins along x ranges.
# Create histograms and frequency polygons with layers mtcars %>% ggvis(~mpg) %>% layer_histograms() mtcars %>% ggvis(~mpg) %>% layer_histograms(width = 2) mtcars %>% ggvis(~mpg) %>% layer_freqpolys(width = 2) # These are equivalent to combining compute_bin with the corresponding # mark mtcars %>% compute_bin(~mpg) %>% ggvis(~x_, ~count_) %>% layer_paths() # With grouping mtcars %>% ggvis(~mpg, fill = ~factor(cyl)) %>% group_by(cyl) %>% layer_histograms(width = 2) mtcars %>% ggvis(~mpg, stroke = ~factor(cyl)) %>% group_by(cyl) %>% layer_freqpolys(width = 2)