Description Usage Arguments References Examples

The "bin" property is for grouping quantitative, continuous data values of a particular field into smaller number of “bins” (e.g., for a histogram).

1 2 |

`vl` |
Vega-Lite object |

`min` |
the minimum bin value to consider. |

`max` |
the maximum bin value to consider. |

`base` |
the number base to use for automatic bin determination. |

`step` |
an exact step size to use between bins. |

`steps` |
an array of allowable step sizes to choose from. |

`minstep` |
minimum allowable step size (particularly useful for integer values). |

`div` |
Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. |

`maxbins` |
the maximum number of allowable bins. |

1 2 3 4 5 6 7 8 | ```
vegalite() %>%
add_data("https://vega.github.io/vega-editor/app/data/movies.json") %>%
encode_x("IMDB_Rating", "quantitative") %>%
encode_y("Rotten_Tomatoes_Rating", "quantitative") %>%
encode_size("*", "quantitative", aggregate="count") %>%
bin_x(maxbins=10) %>%
bin_y(maxbins=10) %>%
mark_point()
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.