View source: R/choropleth.county.R
choropleth.county | R Documentation |
Creates choropleth at the U.S. county level.
choropleth.county( df, id.column = "id", value.column = "value", legend.title = "", legend.text.size = 20, scale.text.size = 16, color.domain = NULL, num.legend.ticks = 5, color.scheme = c("Blues", names(d3po::color.schemes)), width = NULL, height = NULL, viewer = c("internal", "external", "browser") )
df |
data.frame containing value data by county. |
id.column |
Name of column containing identifiers for states/counties. Defaults to "id". All values in this column must match |
value.column |
Name of column containing values by county. Defaults to "value". |
legend.title |
Title of legend, e.g., units. Defaults to "". |
legend.text.size |
Size of text (in points) for legend title. Defaults to 20. |
scale.text.size |
Size of text (in points) for the scale values. Defaults to 16. |
color.domain |
Range of values for the color scale. Defaults to |
num.legend.ticks |
Number of breaks in legend scale. Defaults to 5. |
color.scheme |
Color scheme to use in visualization. See color.schemes for more details. |
width |
Desired width for output widget. |
height |
Desired height for output widget. |
viewer |
"internal" to use the RStudio internal viewer pane for output; "external" to display in an external RStudio window; "browser" to display in an external browser. |
Utilizes a script similar to https://observablehq.com/@d3/choropleth adapted to work with r2d3.
A d3 object as returned by r2d3.
## Not run: data(unemployment.county) choropleth.county(unemployment.county, id.column = "id", value.column = "rate", legend.title = "Unemployment rate (%)") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.