Retour au classement

hustcc/PyG2Plot

Python

🎨 Python3 binding for `@AntV/G2Plot` Plotting Library .

visualizationantvg2plot
Croissance des étoiles
Étoiles
1.1k
Forks
115
Croissance hebdomadaire
Issues
8
5001k
janv. 2021nov. 2022sept. 2024juil. 2026
ArtefactsPyPIpip install pyg2plot
README

PyG2Plot

🎨 Python3 binding for @AntV/G2Plot which an interactive and responsive charting library. Based on the grammar of graphics, you can easily make superior statistical charts through a few lines of code. PyG2Plot is inspired by pyecharts.

Latest Stable Version build Status Pypi Download

Document中文说明文档 · Drawing statistical plots · In Jupyter Notebook · Principles

Installation

$ pip install pyg2plot

Usage

render HTML

from pyg2plot import Plot

line = Plot("Line")

line.set_options({
  "data": [
    { "year": "1991", "value": 3 },
    { "year": "1992", "value": 4 },
    { "year": "1993", "value": 3.5 },
    { "year": "1994", "value": 5 },
    { "year": "1995", "value": 4.9 },
    { "year": "1996", "value": 6 },
    { "year": "1997", "value": 7 },
    { "year": "1998", "value": 9 },
    { "year": "1999", "value": 13 },
  ],
  "xField": "year",
  "yField": "value",
})

# 1. render html file
line.render("plot.html")
# 2. render html string
line.render_html()

image

render Jupyter

from pyg2plot import Plot

line = Plot("Line")

line.set_options({
  "height": 400, # set a default height in jupyter preview
  "data": [
    { "year": "1991", "value": 3 },
    { "year": "1992", "value": 4 },
    { "year": "1993", "value": 3.5 },
    { "year": "1994", "value": 5 },
    { "year": "1995", "value": 4.9 },
    { "year": "1996", "value": 6 },
    { "year": "1997", "value": 7 },
    { "year": "1998", "value": 9 },
    { "year": "1999", "value": 13 },
  ],
  "xField": "year",
  "yField": "value",
})

# 1. render in notebook
line.render_notebook()

# 2. render in jupyter lab
line.render_jupyter_lab()

use JavaScript callback

from pyg2plot import Plot, JS

line = Plot("Line")

line.set_options({
  "height": 400, # set a default height in jupyter preview
  "data": [
    { "year": "1991", "value": 3 },
    { "year": "1992", "value": 4 },
    { "year": "1993", "value": 3.5 },
    { "year": "1994", "value": 5 },
    { "year": "1995", "value": 4.9 },
    { "year": "1996", "value": 6 },
    { "year": "1997", "value": 7 },
    { "year": "1998", "value": 9 },
    { "year": "1999", "value": 13 },
  ],
  "xField": "year",
  "yField": "value",
  "lineStye": JS('''function() {
    return { stroke: 'red' }; 
  }''')
})

Use JS API, you can use JavaScript syntax for callback.

API

Now, only has one API of pyg2plot.

  • Plot
  1. Plot(plot_type: str): get an instance of Plot class.

  2. plot.set_options(options: object): set the options of G2Plot into instance.

  3. *plot.render(path, env, *kwargs): render out html file by setting the path, jinja2 env and kwargs.

  4. *plot.render_notebook(env, *kwargs): render plot on jupyter preview.

  5. *plot.render_jupyter_lab(env, *kwargs): render plot on jupyter lab preview.

  6. *plot.render_html(env, *kwargs): render out html string by setting jinja2 env and kwargs.

  7. *plot.dump_js_options(env, *kwargs): dump js options by setting jinja2 env and kwargs, use it for HTTP request.

More apis is on the way.

License

MIT@hustcc.

Dépôts similaires
d3/d3

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

ShellISC Licensevisualizationdata-visualization
d3js.org
113.3k22.7k
apache/echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser

TypeScriptnpmApache License 2.0echartsdata-visualization
echarts.apache.org
66.9k19.8k
algorithm-visualizer/algorithm-visualizer

:fireworks:Interactive Online Platform that Visualizes Algorithms from Code

JavaScriptnpmMIT Licensealgorithmdata-structure
algorithm-visualizer.org
48.7k7.6k
metabase/metabase

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

ClojureOtheranalyticsbusinessintelligence
metabase.com
48.3k6.7k
NaiboWang/EasySpider

A visual no-code/code-free web crawler/spider易采集:一个可视化浏览器自动化测试/数据采集/网页爬虫软件,可以无代码图形化的设计和执行爬虫任务。别名:ServiceWrapper面向Web应用的智能化服务封装系统。

JavaScriptnpmGNU Affero General Public License v3.0code-freecrawler
easyspider.net
44.3k5.4k
AykutSarac/jsoncrack.com

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

TypeScriptnpmApache License 2.0jsontool
jsoncrack.com
44.3k3.6k
getredash/redash

Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.

PythonPyPIBSD 2-Clause "Simplified" Licenseredashpython
redash.io
28.7k4.6k
chartdb/chartdb

Database diagrams editor that allows you to visualize and design your DB with a single query.

TypeScriptnpmGNU Affero General Public License v3.0databasedb
chartdb.io
22.6k1.4k
thingsboard/thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.

JavaMavenApache License 2.0visualizationiot
thingsboard.io
22.1k6.4k
airbnb/visx

🐯 visx | visualization components

TypeScriptnpmMIT Licensevxreact
visx.airbnb.tech
21k767
qax-os/excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets

GoGo ModulesBSD 3-Clause "New" or "Revised" Licensexlsxexcel
xuri.me/excelize
20.8k1.9k
bokeh/bokeh

Interactive Data Visualization in the browser, from Python

TypeScriptnpmBSD 3-Clause "New" or "Revised" Licensebokehpython
bokeh.org
20.4k4.3k