Skip to main content

Generate heatmap animation with given data and geojson

Project description

heatmapanimation

Python package for generating heatmap animation with given data and geojson.

English | 简体中文

Introduction

If you want to generate a heatmap animation with given data and geojson file or url, you can use this package. You can also type the region name or code replacing the geojson file.

Use 高德地图地理/逆地理编码 get the region code.

Use 阿里云数据可视化平台 get the geojson file.

Note: Currently, the region name must be in Chinese.

Install

pip install heatmapanimation

Usage

import heatmapanimation as hma

heatmap = hma.Heatmap() # create a heatmap object

# set the configuration
heatmap.region = '北京'
heatmap.datafile = './data/data.csv'
heatmap.run_x() # run the animation

API Reference

class heatmapanimation.Heatmap()

You must set a region and datafile before run the animation.
  • region

    The region name you want to generate the heatmap animation. Must be type Chinese region in Chinese.

  • region_code

    The region code you want to generate the heatmap animation. Must be type Chinese region code.

  • region_url

    The url of the geojson file.Or the geojson file path.

  • datafile

    The data file path.

  • data

    The data you want to generate the heatmap animation.

    Options: dict or list or json or pandas.DataFrame.

  • output_format

    The output format of the animation.

    Options: 'gif' or 'mp4'.

  • fig_name

    The name of the output file.

    Note: If you don't set the fig_name, the output file will be named as the region name.

  • color_map

    The colormap of the heatmap.

    Options: 'Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu'.

    All the colormaps are in matplotlib.

    Default: 'Reds'

  • isLegend

    Whether to show the legend.

    Options: True or False.

    Default: False.

  • legend_label

    The label of the legend.

    Options: str.

    Default: 'Temperature'.

  • legend_location

    The location of the legend.

    Options: 'right' or 'right'.

    Default: 'right'.

  • legend_min

    The min value of the legend.

    Options: int or float.

    Default: the minimum of the data.

  • legend_max

    The max value of the legend.

    Options: int or float.

    Default: the maximum of the data.

  • run_x()

    Run the animation and generate frame image and synthetic GIF. Currently, the output format is only 'gif'.

  • run()

    Run the animation with another method which can not show the legend. But the output format is gif, mp4, jshtml and html5.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heatmapanimation-0.0.4.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

heatmapanimation-0.0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file heatmapanimation-0.0.4.tar.gz.

File metadata

  • Download URL: heatmapanimation-0.0.4.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for heatmapanimation-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b9d4409ae23a8a1f36430d8e8d6f7a6d8d192ec069c97419146c5977ab5af57a
MD5 ef1a12d9f230928e8ad0514bd7fe2fb8
BLAKE2b-256 7610c1340bd798314292c9c9f1b9fe5386e44a22b73d6d714d0b859bf4e3fc88

See more details on using hashes here.

File details

Details for the file heatmapanimation-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for heatmapanimation-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f21e15365fda7545772bf5244ac1a037a291f5f53f7095f0e7b351a9eef0b5fd
MD5 6a916b10b076a8ed5a5a1119f500369e
BLAKE2b-256 725894956a36fa175d02b498bfbf59b0d1dc5ada71bdf0e6a6644b71cccc1f84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page