MCPcopy Create free account
hub / github.com/plotly/plotly.py / create_choropleth

Function create_choropleth

plotly/figure_factory/_county_choropleth.py:395–1013  ·  view source on GitHub ↗

**deprecated**, use instead :func:`plotly.express.choropleth` with custom GeoJSON. This function also requires `shapely`, `geopandas` and `plotly-geo` to be installed. Returns figure for county choropleth. Uses data from package_data. :param (list) fips: list of FIPS values w

(
    fips,
    values,
    scope=["usa"],
    binning_endpoints=None,
    colorscale=None,
    order=None,
    simplify_county=0.02,
    simplify_state=0.02,
    asp=None,
    show_hover=True,
    show_state_data=True,
    state_outline=None,
    county_outline=None,
    centroid_marker=None,
    round_legend_values=False,
    exponent_format=False,
    legend_title="",
    **layout_options,
)

Source from the content-addressed store, hash-verified

393
394
395def create_choropleth(
396 fips,
397 values,
398 scope=["usa"],
399 binning_endpoints=None,
400 colorscale=None,
401 order=None,
402 simplify_county=0.02,
403 simplify_state=0.02,
404 asp=None,
405 show_hover=True,
406 show_state_data=True,
407 state_outline=None,
408 county_outline=None,
409 centroid_marker=None,
410 round_legend_values=False,
411 exponent_format=False,
412 legend_title="",
413 **layout_options,
414):
415 """
416 **deprecated**, use instead
417 :func:`plotly.express.choropleth` with custom GeoJSON.
418
419 This function also requires `shapely`, `geopandas` and `plotly-geo` to be installed.
420
421 Returns figure for county choropleth. Uses data from package_data.
422
423 :param (list) fips: list of FIPS values which correspond to the con
424 catination of state and county ids. An example is '01001'.
425 :param (list) values: list of numbers/strings which correspond to the
426 fips list. These are the values that will determine how the counties
427 are colored.
428 :param (list) scope: list of states and/or states abbreviations. Fits
429 all states in the camera tightly. Selecting ['usa'] is the equivalent
430 of appending all 50 states into your scope list. Selecting only 'usa'
431 does not include 'Alaska', 'Puerto Rico', 'American Samoa',
432 'Commonwealth of the Northern Mariana Islands', 'Guam',
433 'United States Virgin Islands'. These must be added manually to the
434 list.
435 Default = ['usa']
436 :param (list) binning_endpoints: ascending numbers which implicitly define
437 real number intervals which are used as bins. The colorscale used must
438 have the same number of colors as the number of bins and this will
439 result in a categorical colormap.
440 :param (list) colorscale: a list of colors with length equal to the
441 number of categories of colors. The length must match either all
442 unique numbers in the 'values' list or if endpoints is being used, the
443 number of categories created by the endpoints.\n
444 For example, if binning_endpoints = [4, 6, 8], then there are 4 bins:
445 [-inf, 4), [4, 6), [6, 8), [8, inf)
446 :param (list) order: a list of the unique categories (numbers/bins) in any
447 desired order. This is helpful if you want to order string values to
448 a chosen colorscale.
449 :param (float) simplify_county: determines the simplification factor
450 for the counties. The larger the number, the fewer vertices and edges
451 each polygon has. See
452 http://toblerity.org/shapely/manual.html#object.simplify for more

Callers

nothing calls this directly

Calls 12

PlotlyErrorClass · 0.90
_create_us_counties_dfFunction · 0.85
intFunction · 0.85
_intervals_as_labelsFunction · 0.85
_calculationsFunction · 0.85
tolistMethod · 0.80
simplifyMethod · 0.80
updateMethod · 0.45
countMethod · 0.45
formatMethod · 0.45
removeMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected