当前位置:网站首页>04 pyechars geographic chart (example code + effect diagram)
04 pyechars geographic chart (example code + effect diagram)
2022-07-28 12:52:00 【Lazy smile】
Catalog
1 GEO- Geographic coordinate system
1 GEO- Geographic coordinate system
import random
from pyecharts.charts import Geo
from pyecharts.faker import Faker
province = [
' guangdong ',
' hubei ',
' hunan ',
' sichuan ',
' Chongqing ',
' heilongjiang ',
' Zhejiang ',
' shanxi ',
' hebei ',
' anhui ',
' Henan ',
' Shandong ',
' Tibet ']
data = [(i, random.randint(10, 100)) for i in province]
geo = (
Geo()
.add_schema(maptype="china")
.add("geo", [list(z) for z in zip(Faker.provinces, Faker.values())])
# .add("", data)
)
print([list(z) for z in zip(Faker.provinces, Faker.values())])
geo.render("geo.html")
2 MAP- Map
import random
from pyecharts.charts import Map
province = [
' guangdong ',
' hubei ',
' hunan ',
' sichuan ',
' Chongqing ',
' heilongjiang ',
' Zhejiang ',
' shanxi ',
' hebei ',
' anhui ',
' Henan ',
' Shandong ',
' Tibet ']
data = [(i, random.randint(10, 100)) for i in province]
map_ = (
Map()
.add("", data, 'china')
)
map_.render("map.html")
3 BMAP- Baidu Maps
import random
from pyecharts.charts import BMap
province = [
' guangdong ',
' hubei ',
' hunan ',
' sichuan ',
' Chongqing ',
' heilongjiang ',
' Zhejiang ',
' shanxi ',
' hebei ',
' anhui ',
' Henan ',
' Shandong ',
' Tibet ']
data = [(i, random.randint(50, 150)) for i in province]
bmap = (
BMap()
.add_schema(baidu_ak=" Enter your Baidu AK", center=[120.13066322374, 30.240018034923])
.add("", data)
)
bmap.render("bmap.html")1 Geo()
class Geo(
# Initialize configuration items , Reference resources `global_options.InitOpts`
init_opts: opts.InitOpts = opts.InitOpts()
# Whether to ignore nonexistent coordinates , The default value is False, That is not to ignore
is_ignore_nonexistent_coord: bool = False
)
2 def add_schema
def add_schema(
# Map type , Specific reference pyecharts.datasets.map_filenames.json file
maptype: str = "china",
# Whether to turn on mouse zoom and pan roaming .
is_roam: bool = True,
# The zoom of the current view . The default is 1
zoom: Optional[Numeric] = None,
# The center of the current perspective , Expressed in latitude and longitude . for example :center: [115.97, 29.71]
center: Optional[Sequence] = None,
# Parameters are used for scale The aspect ratio of the map .
aspect_scale: types.Numeric = 0.75,
# Two dimensional array , Define the longitude and latitude corresponding to the upper left corner and the lower right corner of the positioning .
bounding_coords: types.Optional[types.Sequence[types.Numeric]] = None,
# Minimum zoom value .
min_scale_limit: types.Optional[types.Numeric] = None,
# Maximum zoom value .
max_scale_limit: types.Optional[types.Numeric] = None,
# The default is 'name', in the light of GeoJSON Custom attribute name of the feature , As a primary key, it is used to associate data points and GeoJSON Geographical elements .
name_property: str = "name",
# Selected mode , Indicates whether multiple selections are supported , Off by default , Boolean and string support .
# String values are optional 'single' According to the radio , perhaps 'multiple' Multiple choice .
selected_mode: types.Union[bool, str] = False,
# pyecharts Not available for the time being left/top/right/bottom Configuration of
# layoutCenter and layoutSize Provided in addition to left/right/top/bottom/width/height Outside the layout means .
# In the use of left/right/top/bottom/width/height When
# It may be difficult to keep the map box wider than the middle of the map , And ensure that it does not exceed the range of box shape .
# At this time, you can use the layoutCenter Property defines the location of the map center on the screen ,layoutSize Define the size of the map .
# The following example
# layoutCenter: ['30%', '30%'],
# // If the aspect ratio is greater than 1 The width is 100, If it is less than 1 Then the height is 100, Guaranteed not to exceed 100x100 Region
# layoutSize: 100
layout_center: types.Optional[types.Sequence[str]] = None,
# The size of the map , see layoutCenter. Support percentage relative to screen width and height or absolute pixel size .
layout_size: types.Union[str, types.Numeric] = None,
# # Tag configuration item , Reference resources `series_options.LabelOpts`
label_opts: Union[opts.LabelOpts, dict, None] = None,
# Polygons in the map area Graphic style .
itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] =None,
# Polygon style in highlighted state
emphasis_itemstyle_opts: Union[opts.ItemStyleOpts, dict,None] = None,
# The label style in the highlighted state .
emphasis_label_opts: Union[opts.LabelOpts, dict, None] =None,
):
3 def add()
def add(
# Series name , be used for tooltip Display of ,legend The legend selection of .
series_name: str,
# Data item ( Coordinate point name , Coordinate point values )
data_pair: Sequence,
# Geo Picture type , Yes scatter, effectScatter, heatmap, lines 4 Kind of , It is recommended to use
# from pyecharts.globals import GeoType
# GeoType.GeoType.EFFECT_SCATTER,GeoType.HEATMAP,GeoType.LINES
type_: str = "scatter",
# Check legend
is_selected: bool = True,
# Mark graphic shapes
symbol: Optional[str] = None,
# The size of the mark
symbol_size: Numeric = 12,
# The size of each point , In the geographical coordinate system (coordinateSystem: 'geo') On the effective .
blur_size: types.Numeric = 20,
# The size of each point blur , In the geographical coordinate system (coordinateSystem: 'geo') On the effective .
point_size: types.Numeric = 20,
# series label Color
color: Optional[str] = None,
# Whether it is a polyline , Painting lines In the case of FIG
is_polyline: bool = False,
# Whether to enable the optimization of large-scale line graph , When there are many data graphs (>=5k) Can be opened
is_large: bool = False,
# The length of the effect's wake . From 0 To 1 Value , The larger the value, the longer the wake . The default value is 0.2
trail_length: Numeric = 0.2,
# Turn on the threshold of drawing optimization .
large_threshold: Numeric = 2000,
# Configure the number of graphics rendered per frame of the series
progressive: types.Numeric = 400,
# Threshold for the number of shapes that enable progressive rendering , Enable progressive rendering when the number of graphics in a single series exceeds this threshold .
progressive_threshold: types.Numeric = 3000,
# Tag configuration item , Reference resources `series_options.LabelOpts`
label_opts: Union[opts.LabelOpts, dict] = opts.LabelOpts(),
# Ripple effect configuration item , Reference resources `series_options.EffectOpts`
effect_opts: Union[opts.EffectOpts, dict] = opts.EffectOpts(),
# Line style configuration item , Reference resources `series_options.LineStyleOpts`
linestyle_opts: Union[opts.LineStyleOpts, dict] = opts.LineStyleOpts(),
# Prompt box component configuration item , Reference resources `series_options.TooltipOpts`
tooltip_opts: Union[opts.TooltipOpts, dict, None] = None,
# Element style configuration item , Reference resources `series_options.ItemStyleOpts`
itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] = None,
# This configuration is relatively complex ( Reference address : https://www.echartsjs.com/zh/option.html#series-custom.renderItem)
render_item: types.JsCode = None,
# This configuration is relatively complex ( Reference address : https://www.echartsjs.com/zh/option.html#series-custom.encode)
encode: types.Union[types.JsCode, dict] = None,
)
边栏推荐
- Is it overtime to be on duty? Take up legal weapons to protect your legitimate rights and interests. It's time to rectify the working environment
- Uniapp 应用开机自启插件 Ba-Autoboot
- 01 pyechars 特性、版本、安装介绍
- 云原生—运行时环境
- XIII Actual combat - the role of common dependence
- 输入字符串,内有数字和非字符数组,例如A123x456将其中连续的数字作为一个整数,依次存放到一个数组中,如123放到a[0],456放到a[1],并输出a这些数
- Application and download of dart 3D radiative transfer model
- Developing NES game (cc65) 03 and VRAM buffer with C language
- Leetcode206 reverse linked list
- Sliding Window
猜你喜欢

连通块&&食物链——(并查集小结)

Problem solving during copilot trial

Interface control telerik UI for WPF - how to use radspreadsheet to record or comment

一台电脑上 多个项目公用一个 公私钥对拉取gerrit服务器代码

MarkDown简明语法手册

Merge sort

Zurich Federal Institute of technology | reference based image super resolution with deformable attention transformer (eccv2022))

leetcode:704二分查找

图书馆自动预约脚本

scala 转换、过滤、分组、排序
随机推荐
Sliding Window
通过Jenkins 拉取服务器代码 权限不足问题及其他注意事项
LeetCode206 反转链表
Sliding Window
Force buckle 315 calculates the number of elements smaller than the current element on the right
stm32 回环结构接收串口数据并处理
FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be depreca
Holes in [apue] files
BA autoboot plug-in of uniapp application boot
非标自动化设备企业如何借助ERP系统,做好产品质量管理?
What is C generic, generic cache, generic constraint
Uninstall Navicat: genuine MySQL official client, really fragrant!
Custom paging tag 02 of JSP custom tag
How to realize more multimedia functions through the ffmpeg library and NaPi mechanism integrated in openharmony system?
mysql limit 分页优化
HC-05蓝牙模块调试从模式和主模式经历
Science 重磅:AI设计蛋白质再获突破,可设计特定功能性蛋白质
AVL tree (balanced search tree)
机器学习实战-神经网络-21
C for循环内定义int i变量出现的重定义问题