Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use graphic Table Library G2Plot based on graphic Grammar

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to use the graphic grammar-based graphic library G2Plot. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

G2Plot

A set of simple, easy-to-use, scalable and combinatorial statistical chart libraries are built based on the theory of graphic grammar. G2 in "G2Plot" means graphic grammar (the Grammar of Graphics) and pays homage to ggplot2. There are three things we want to do:

So that users can easily produce elegant and beautiful charts without becoming visualization experts.

Ensure that the chart can stand the business test and is easy to use and easy to use in real situations.

Explore more possibilities of statistical charts to make statistical charts more fun and cool.

Characteristics

Out-of-the-box, elegant, high-quality statistical charts

Responsive: make charts smarter

In the real chart application scene, a thorny problem is that the display space of the chart is often not enough to display the amount of data of the chart, resulting in the overlapping occlusion of the text in the extreme case, content can not adapt, content cutting and other problems. Drawing lessons from the idea of tolerance design, G2Plot dilute the auxiliary information of the chart when the information density of the chart is too high to ensure the display and basic readability of the main information of the chart.

Step forward: a chart that tells stories

In the G2Plot system, charts are not only irrelevant examples, the introduction of the concept of layer provides the possibility of multi-chart combination, superposition and linkage to tell a data story together. In the future, we will also explore the possibility of transforming statistical charts into information charts and enrich the performance ability of statistical charts.

Install pip install pyg2plotrender HTMLfrom pyg2plot import Plotline = 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 fileline.render ("plot.html") # 2. Render html stringline.render_html ()

Render Jupyterfrom pyg2plot import Plotline = 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 notebookline.render_notebook () # 2. Render in jupyter labline.render_jupyter_lab () the above is how to use G2Plot, a graphic grammar-based graph library shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report