matrix:pyechartsstorehouse,echarts-countries-pypkg,echarts-china-provinces-pypkg,echarts-china-cities-pypkg
Data: highs lows and weather types across the country for April 16, 2018 - (crawled by crawler)
Code: weather data crawler code, chart plotting code Code Address:/goodloving/(py file)
I. Public attributes
1, the title bar attributes: generally given in the instantiation (initialization) type, such as bar = Bar ("big title", "sub-title", - a variety of attributes -)
title_color = "color": title color, can be 'red' or '#0000'
title_pos = 'position': title position, e.g. 'center', 'left' ---
width = 1200: width of the chart
height = 800: height of the chart
background_color = "color": background color of the chart
·····
2. Attributes of the label bar: e.g. ("label", x, values, --- attributes ---)
'mark_' class, through a 'mark_' display, such as mark_point['max', 'min', 'average']: mark the maximum, minimum and average point of the
mark_point_textcolor,mark_line_symbolsize·····
'legend_' class, e.g. legend_pos='left': position of the label
'is_' class, e.g. is_label_show=True: shows the value of each point, is_datazoom_show=True: implements the amount of movement control x-axis
is_convert = True: whether the x and y axes are converted or not
eg:
bar = ("Highs across the country.", "2018-4-18", title_color='red', title_pos='right', width=1400, height=700, background_color='#404a59') ("Maximum temperature", cities, highs, mark_point=['max', 'min', 'average'], is_label_show=True, is_datazoom_show=True, legend_pos='left') ('')
3、Geo, Map can not display the bottom map
After pyecharts v0.3.2, pyecharts will no longer come with map js files. If you need to use map charts, you can install the corresponding map file package by yourself.
The map file is split into three Python packages, which are:
Global country maps: echarts-countries-pypkg (1.9MB)
Provincial maps of China: echarts-china-provinces-pypkg (730KB)
Municipal maps of China: echarts-china-cities-pypkg (3.8MB)
(1) Pycharm searches for and installs the three libraries directly in the settings.
(2) pip installation
pip install echarts-countries-pypkg pip install echarts-china-provinces-pypkg pip install echarts-china-cities-pypkg
II. Various charts and graphs
1. Column/Bar Chart - Bar
bar = ("Maximum and minimum temperatures across the country.", "2018-4-18", title_pos='right', title_color='blue', width=1400, height=700,background_color='white') ("Maximum temperature", cities, highs, mark_point=['max'], legend_text_color='red', is_datazoom_show=True) ("Minimum temperature", cities, lows, mark_line=['min'], legend_text_color='blue' ) ('')
2, scatter plot - EffectScatter
es = ("Scatterplot of minimum temperature dynamics.", "2018-4-16", title_pos='right', title_color='blue', width=1400, height=700, background_color='white') ("Minimum temperature", range(0, len(cities)), lows, legend_pos='center', legend_text_color='blue',symbol_size=10, effect_period=3, effect_scale=3.5, symbol='pin',is_datazoom_show=True,is_label_show=True) ("")
3. Funnel and - Funnel
fl = ("Maximum Temperature Funnel Chart.", "2018-40-16", title_pos='left', width=1400, height=700) ("Minimum temperature", cities[:15], lows[:15], is_label_show=True, label_pos='inside', label_text_color='white') ("")
4. Dashboard - Guage
gu = ("Dashboard diagram.") ("Indicators", "Meeting the standard.", 80) ("")
5. Geographic coordinates map - Geo
geo = ("Map of the geographic coordinate system of maximum temperatures", '2018-4-16', title_color='#fff', title_pos='center', width=1200, height=600, background_color='#404a95') ("Maximum temperature", cities, highs, is_visualmap=True, visual_range=[0, 40], visual_text_color='#fff', symbol_size=5, legend_pos='right',is_geo_effect_show=True) ("")
6. Relationship diagrams - Graph (omitted)
7, folding line / area diagram - Line
line = ("Line graphs of temperature change.", '2018-4-16', width=1200, height=600) ("Maximum temperature", cities, highs, mark_point=['average'], is_datazoom_show=True) ("Minimum temperature", cities, lows, mark_line=['average'], is_smooth=True) ('')
line = ("Line graphs of temperature change.", '2018-4-16', width=1200, height=600) ("Maximum temperature", cities, highs, mark_point=['average'], is_datazoom_show=True, is_fill=True, line_opacity=0.2, area_opacity=0.4) ("Minimum temperature", cities, lows, mark_line=['average'], is_smooth=True, is_fill=True, area_color="#000", area_opacity=0.5) ('')
8. Water drop ball - Liquid
lq = ("Water drop ball.") ("Liquid", [0.8, 0.5, 0.2], is_liquid_outline_show=False, is_liquid_animation=True) ("")
9、Map-Map
a_city = [] for i in cities: a_city.append(i + 'City') map = ("Lowest Temperature in Lakeland", width=1200, height=600) ("Minimum temperature", a_city, lows, maptype='Hubei', is_visualmap=True, visual_text_color='#000', visual_range= [-15, 20]) ("")
value = [95.1, 23.2, 43.3, 66.4, 88.5] attr= ["China", "Canada", "Brazil", "Russia", "United States"] map = Map("Example of a world map", width=1200, height=600) ("", attr, value, maptype="world", is_visualmap=True, visual_text_color='#000') ('')
10、Parallel coordinate chart--Parallel
parallel = ("Plot of parallel coordinate systems for high and low temperatures.", '2018-4-16', width=1200, height=600) (cities[:20]) ("High and low temperatures", [highs[:20], lows[:20]], is_random=True) ('')
11. Pie chart - Pie
sun = 0 cloud = 0 lit_rain = 0 mit_rain = 0 sail = 0 shadom = 0 z_rain = 0 th_rain = 0 for i in types: if i == 'Clear': sun += 1 elif i == 'Cloudy': cloud += 1 elif i == 'Little Rain': lit_rain += 1 elif i == 'Mid-rain': mit_rain += 1 elif i == 'Yin': shadom += 1 elif i == 'Showers': z_rain += 1 elif i == 'Thunderstorms': th_rain += 1 elif i == 'Raising sand': sail += 1 pie = ("Proportion of weather types in the country", '2018-4-16') ('Weather type', weather, [mit_rain, lit_rain, sail, sun, th_rain, cloud, shadom, z_rain], is_label_show=True) ('')
Modification:
pie = ("Proportion of weather types in the country", '2018-4-16', title_pos='center') ('Weather type', weather, [mit_rain, lit_rain, sail, sun, th_rain, cloud, shadom, z_rain], is_label_show=True, legend_pos='left', label_text_color=None, legend_orient='vertical', radius=[30, 75]) ('')
pie inlay:
center -> list
the center (center of the circle) coordinates of the pie chart, the first item of the array is the horizontal coordinate, the second item is the vertical coordinate, the default is [50, 50] the default is set to a percentage, set to a percentage of the first item is relative to the width of the container, the second item is relative to the height of the container
rosetype -> str
Whether or not to show as a Nightingale chart, differentiate the data size by radius, there are two modes 'radius' and 'area'. Default is 'radius' radius: the percentage of sector center angle to show the data, radius to show the size of the data area: all sectors have the same center angle, only the size of the data is shown by the radius.
pie = ("Proportion of weather types in the country", '2018-4-16') ('', weather, [mit_rain, lit_rain, sail, sun, th_rain, cloud, shadom, z_rain], is_label_show=True, label_text_color=None, legend_orient='vertical', radius=[40, 50], center=[50, 50]) ('', ['rainy', 'drizzle', 'raise sand', 'fine (weather)'], [lit_rain, mit_rain, sun, sail], radius=[10, 35], center=[50, 50], rosetype='area') ('')
At this point, pyecharts most of the icon drawing we can realize, more knowledge can check the following link
This is the entire content of this article.