The use of "Python data visualization" Pyecharts __python

Source: Internet
Author: User
Tags radar

Echarts Baidu is very famous also very diao.
Echarts is Baidu Open source of a data visualization JS library. Mainly used for data visualization.
Pyecharts is a class library that is used to generate echarts charts. is actually the butt of echarts and Python.

Url:
Https://github.com/chenjiandongx/pyecharts/blob/master/docs/zh-cn/documentation.md#%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8

http://pyecharts.org/#/zh-cn/charts?id=wordcloud%ef%bc%88%e8%af%8d%e4%ba%91%e5%9b%be%ef%bc%89

Installation:

Pip Install Pyecharts

Common Configuration Items

Xyaxis: x, y axis in rectangular coordinate system (line, Bar, scatter, effectscatter, Kline)
The Datazoom:datazoom component is used for area scaling, allowing for free attention to details of the data, or overview of the data as a whole, or to remove the impact of outliers. (line, Bar, scatter, Effectscatter, Kline, BoxPlot)
Legend: Legend component. The legend component shows the different series of tags (symbol), colors, and names. You can control which series is not displayed by clicking on the legend.
Label: a text label on a graphic that can be used to illustrate some data about a graphic, such as a value, a name, and so on.
LineStyle: Style options for lines with line graphics (line, Polar, Radar, Graph, Parallel)
GRID3D:3D Cartesian coordinate system group configuration items, suitable for 3D graphics. (Bar3d, Line3d, Scatter3d)
axis3d:3d Cartesian coordinate system x,y,z axis configuration items, suitable for 3D graphics. (Bar3d, Line3d, Scatter3d)
Visualmap: is a visual mapping component for "visual coding", that is, mapping data to visual elements (visual Channels)
Markline&markpoint: A graphical markup component that marks the specified special data, and marks two of lines and markers. (Bar, line, Kline)
ToolTip: Cue box component that pops up data when moving or clicking the mouse

Chart Detail

Bar (histogram/bar chart)
Bar3d (3D bar chart)
BoxPlot (Box chart)
Effectscatter (scatter plot with ripple effects animation)
Funnel (funnel chart)
Gauge (instrument panel)
Geo (geographical coordinate system)
Graph (diagram)
Heatmap (thermal diagram)
Kline (k-line chart)
Line (polyline/area chart)
Line3d (3D Line chart)
Liquid (water polo diagram)
Map (MAPS)
Parallel (parallel coordinate system)
Pie (pie chart)
Polar (polar coordinate system)
Radar (Radar map)
Sankey (Sankey map)
Scatter (scatter chart)
Scatter3d (3D scatter chart)
Themeriver (Theme river map)
Wordcloud (Word cloud)

user-defined

Grid class: Display more than one image in parallel
Overlap Class: Combining different types of graphs superimposed on the same picture
Page class: Show multiple graphs in order
Timeline class: Provides time line carousel multiple picture

Integrated Flask&django

To start using:

# encoding:utf-8
import time
import sys
reload (SYS)
sys.setdefaultencoding (' Utf-8 ')


from  Pyecharts Import Bar
= Bar ("My first chart", "Here is subtitle")
Bar.add ("Costume", ["shirt", "cardigan", "chiffon shirt", "Pants", "high Heels", "socks"], [5, 20, 90],is_more_utils=true)
bar.show_config ()
Bar.render ()

Note: You can download the picture locally by pressing the download button on the right, and if you want to provide more utility buttons, set Is_more_utils to True in Add ()

Add ()
Primary method for adding data to a chart and setting various configuration items
Show_config ()
PrintOut all configuration items for the chart
Render ()
By default, a render.html file is generated in the root directory, supporting the path parameter, setting the file save location, such as render (R "E:\my_first_chart.html"), and the file is opened in a browser.

to introduce a new feature, the page () class is recommended if you want to display multiple graphs sequentially in a Web page.

Use steps

1. Introduce Page

2, the use of page.add () to increase the figure

3. Use Page.render () to render web pages

Show multiple graphs

# encoding:utf-8
import time
import sys
reload (SYS)
sys.setdefaultencoding (' Utf-8 ')

from Pyecharts import Bar, scatter3d from
pyecharts Import Page


= page ()         # step 1

# Bar
attr = [' Shirt ', "Woolen Sweater", "chiffon shirt", "trousers", "high Heels", "socks"] V1 = [5, M, M, M
]
v2 = [A, 8,]
bar = bar ("Bar chart data Stacking example ")
Bar.add (" Merchant A ", attr, V1, is_stack=true)
Bar.add (" Merchant B ", attr, V2, is_stack=true)
Page.add (BAR)         # step 2



# scatter3d
import random
data = [[Random.randint (0, MB), Random.randint (0, 100), Random.randint (0)] for _ in range]
range_color = [' #313695 ', ' #4575b4 ', ' #74add1 ', ' #abd9e9 ', ' #e0f3f8 ', ' #f ' FFFBF ',
               ' #fee090 ', ' #fdae61 ', ' #f46d43 ', ' #d73027 ', ' #a50026 ']
Scatter3d = Scatter3d ("3D Scatter chart Example", width=1200, height=600)
Scatter3d.add ("", Data, Is_visualmap=true, Visual_range_color=range_color)
Page.add ( Scatter3d)  # step 2

Page.render ()        # Step 3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.