Reference#
Compute continuous cartograms.
- class cartogram.Cartogram(input_polygon_geodataframe, cartogram_attribute, max_iterations=10, max_average_error=0.1, verbose=False, **kwargs)#
Compute continuous cartograms.
This is an implementation of the Dougenik et al. (1985) algorithm to approximate areal cartograms from numeric data columns. cartogram.Cartogram inherits from geopandas.GeoDataFrame, which means that all methods and attributes implemented there are available in the result object.
- Parameters:
input_polygon_geodataframe (geopandas.GeoDataFrame) – The input polygon data set
cartogram_attribute (str | pandas.Series) – Which numeric attribute to use to distort the polygon data
max_iterations (int) – How often to iterate the computation (default: 10)
max_average_error (float) – Stop earlier than max_iterations if the average areal error reaches below max_average_error (a ratio between the target set by the attribute values and the actual area) (default: 0.1)
- property area_value_ratio#
Ratio between total area and total value.
- property average_error#
The error between the current geometries and a perfect cartogram.
- property total_area#
Total area of all polygons.
- property total_value#
Sum of the values of cartogram_attribute over all polygons.