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 Python echarts to realize data Visualization

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article focuses on "how to use Python echarts to achieve data visualization", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use Python echarts to achieve data visualization"!

1. Overview

Pyecharts is Baidu open source, suitable for data visualization tools, flexible configuration, display charts are relatively beautiful, smooth.

two。 Installation

Installation in python3 environment:

Pip3 install pyecharts3. Data visualization code 3.1histogram from pyecharts import options as optsfrom pyecharts.charts import Barfrom pyecharts.faker import Fakerc = (Bar () .add _ xaxis (Faker.choose ()) .add _ yaxis ("merchant A", Faker.values (), stack= "stack1") .add _ yaxis ("merchant B", Faker.values ()) Stack= "stack1") .set _ series_opts (label_opts=opts.LabelOpts (is_show=False)) .set _ global_opts (title_opts=opts.TitleOpts (title= "Bar- stacked data (all) .render (" bar_stack0.html "))

Executing the above code generates a mycharts.html file in the relative directory and opens it through the page.

3.2 Line chart import pyecharts.options as optsfrom pyecharts.charts import Line "" Gallery uses pyecharts 1.1.0 reference address: functions currently not available in https://echarts.apache.org/examples/editor.html?c=line-smooth: "" x_data = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] y_data = [820,932,901,934, 1290, 1330 1320] (Line () .set _ global_opts (tooltip_opts=opts.TooltipOpts (is_show=False), xaxis_opts=opts.AxisOpts (type_= "category"), yaxis_opts=opts.AxisOpts (type_= "value", axistick_opts=opts.AxisTickOpts (is_show=True), splitline_opts=opts.SplitLineOpts (is_show=True),) ) .add _ xaxis (xaxis_data=x_data) .add _ yaxis (series_name= ", y_axis=y_data, symbol=" emptyCircle ", is_symbol_show=True, is_smooth=True, label_opts=opts.LabelOpts (is_show=False),) .render (" smoothed_line_chart.html "))

From pyecharts import options as optsfrom pyecharts.charts import Piefrom pyecharts.faker import Fakerc = (Pie () .add ("", [list (z) for z in zip (Faker.choose (), Faker.values ())], radius= ["40%", "75"],) .set _ global_opts (title_opts=opts.TitleOpts (title= "Pie-Radius"), legend_opts=opts.LegendOpts (orient= "vertical") Pos_top= "15%", pos_left= "2%"),) .set _ series_opts (label_opts=opts.LabelOpts (formatter= "{b}: {c}")) .render ("pie_radius.html"))

At this point, I believe you have a deeper understanding of "how to use Python echarts to achieve data visualization". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report