Skip to main content

Python3 binding for `@AntV/G2` Plotting Library .

Project description

pyG2

Python3 binding for @AntV/G2 Plotting Library .

Install

  1. 从pypi安装

    pip install -U pip
    pip install g2
    
  2. 从源码安装

    pip install -U pip
    pip install git+https://github.com/Jasonsey/pyG2.git
    

Quick Start

from g2 import Chart


def example_interval():
    chart = Chart(container='container', width=640, height=480)
    chart.interval().data([
        {'genre': 'Sports', 'sold': 275},
        {'genre': 'Strategy', 'sold': 115},
        {'genre': 'Action', 'sold': 120},
        {'genre': 'Shooter', 'sold': 350},
        {'genre': 'Other', 'sold': 150},
    ]).encode('x', 'genre').encode('y', 'sold').encode('color', 'genre')
    chart.render()

    
example_interval()

img.png

更多例子可以通过g2_examples这个模块进行查看, 例如上面的例子可以通过下面的代码访问

from g2_examples.api import example_interval


example_interval()

Reference

  1. @AntV/G2官方文档
  2. @AntV/G2官方代码仓库
  3. PyG2Plot官方仓库

Attention

  1. 暂时不支持自定义js函数,因此参数中包含lambda函数的参数都暂时无法使用, 例如各种callback
  2. 参数里面如果传输component也暂时不支持,例如custom palette中的type. 主要影响各种custom组件
  3. 暂时不支持子图的创建,预计会在未来必要时维护该功能

TODO

  • dataclass自动转换
  • kwargs自动处理
  • xxx_ 参数名自动转 xxx
  • Tuple类型转转json时自动转List
  • G2模块依赖关系分析
  • 整理需要对外暴露的接口
  • 维护例子代码文档

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

g2-2024.6.30.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

g2-2024.6.30-py3-none-any.whl (39.5 kB view details)

Uploaded Python 3

File details

Details for the file g2-2024.6.30.tar.gz.

File metadata

  • Download URL: g2-2024.6.30.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for g2-2024.6.30.tar.gz
Algorithm Hash digest
SHA256 16f13a147bb48896dba0ebf487ff468db71102841778ceeb6b72f1df6e460629
MD5 4aeb1d87eefebbeed4f1610c69e14062
BLAKE2b-256 23706e8c8c4967baba0ac23e5e9f66dfef109cd364e2d5f001ff00a52a6c23cf

See more details on using hashes here.

File details

Details for the file g2-2024.6.30-py3-none-any.whl.

File metadata

  • Download URL: g2-2024.6.30-py3-none-any.whl
  • Upload date:
  • Size: 39.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for g2-2024.6.30-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec132ce390d1765acdbb354da3a2fddcc97b5e8a6c16720ed6b17c8e9e3e4da
MD5 3b0a64244e4a8e578d952d7f18a08902
BLAKE2b-256 c17bc5c9390ba8da31c9707be9ce85b2c9cf1d0965be67a3a7cdd149447dbfaa

See more details on using hashes here.

Supported by

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