3

继Pyecharts之后,蚂蚁又开源一款国产可视化利器

 2 years ago
source link: https://blog.csdn.net/qq_21478261/article/details/121848932
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

继Pyecharts之后,蚂蚁又开源一款国产可视化利器

专栏收录该内容
83 篇文章 24 订阅

续前篇👉中国人自己的可视化利器:Pyecharts,本期分享另一个国人可视化工具PyG2Plot。

介绍之前,梳理下G2、G2Plot、PyG2Plot三者关系,

G2:一套由蚂蚁集团数据可视化团队(AntV)开发,基于图层图形语法(the grammar of graphics,同ggplot2底层语法)的可视化底层高交互引擎;

G2Plot:基于G2封装,力求开箱即用、易于配置、具有良好交互体验的JavaScript统计图表库;

PyG2Plot:基于 G2Plot 封装的Python统计图表库,借鉴Pyecharts图表实现形式,但比Pyecharts更简练。

总之,G2Plot之于PyG2Plot就如同Pyecharts之于Echarts。


pip install pyg2plot

由于PyG2Plot 是完全基于G2Plot的封装,并且在数据结构上,完全不做任何二次封装,所以配置文档上完全可以参考 G2Plot 官方文档。

下面用几个案例来说明如何参考G2Plot官方文档,使用PyG2Plot,

案例一、桑基图

G2Plot地址:https://antv-g2plot.gitee.io/zh/examples/relation-plots/sankey#energy

将上图绘图数据和核心代码照抄到PyG2Plot中即可实现相同功能👇

重点参数都位于set_options()中,更多个性化设置参考G2Plot2文档:https://antv-g2plot.gitee.io/zh/examples/relation-plots/sankey#energy

个人感觉文档比Pyecharts的文档更适合人看,API中罗列所有参数详细说明,设计指引中详细说明该图表的使用场景、数据要求及设计建议,因为G2Plot2目前还处于开发状态,有的图表设计指引为空。

以修改color参数为例,API中检索color,

传入色号,

案例二、弦图

G2Plot地址:https://antv-g2plot.gitee.io/zh/examples/relation-plots/chord#chord-population

PyG2Plot中实现和案例一一样,直接贴上PyG2Plot实现代码,

案例三、面积图

G2Plot地址:https://antv-g2plot.gitee.io/zh/examples/area/stacked#basic-slider

PyG2Plot实现代码, 


G2Plot包含大量案例,理论上PyG2Plot都可用,


G2Plot还处于开发中,未来可期;

G2Plot在地理图表方面很欠缺,官网几乎没有示例,看到的小伙伴可以私信一下~;

和Pyechart/Echarts相比,PyG2Plot还是太稚嫩,所以,所以,再见Pyechart、吊打Pyecharts芸芸还为时过早😓😓


进一步学习

https://github.com/hustcc/PyG2Plot

https://github.com/antvis/G2Plot


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK