Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图
【摘要】 Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图
目录
利用pyecharts绘制地图十多个地区流动轨迹动态图
Geo(GeoChartBase)函数
相关文章Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图...
Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图
目录
相关文章
Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图
Python之pyecharts:利用pyecharts绘制地图十多个地区流动轨迹动态图实现
利用pyecharts绘制地图十多个地区流动轨迹动态图
Geo(GeoChartBase)函数
Geo(init_opts=opts.InitOpts())
-
class Geo Found at: pyecharts.charts.basic_charts.geo
-
-
class Geo(GeoChartBase):
-
"""
-
<<< geo coordinate system >>>
-
-
support scatter plot and line
-
"""
-
def __init__(
-
self,
-
init_opts:types.Init=opts.InitOpts(),
-
is_ignore_nonexistent_coord:bool=False):
-
super().__init__(init_opts=init_opts)
-
self._coordinate_system = "geo"
-
self._is_ignore_nonexistent_coord =
-
is_ignore_nonexistent_coord
-
-
def _feed_data(self, data_pair:types.Sequence,
-
type_:str)->types.Sequence:
-
result = []
-
for n, v in data_pair:
-
try:
-
if type_ == ChartType.LINES:
-
f, t = self.get_coordinate(n), self.
-
get_coordinate(v)
-
result.append({"name":"{}->{}".format(n, v),
-
"coords":[f, t]})
-
else:
-
lng, lat = self.get_coordinate(n)
-
result.append({"name":n, "value":[lng, lat,
-
v]})
-
except TypeError as err:
-
if self._is_ignore_nonexistent_coord is not
-
True:
-
raise NonexistentCoordinatesException
-
(err, (n, v))
-
-
return result
-
-
def add_schema(
-
self,
-
maptype:str="china",
-
is_roam:bool=True,
-
zoom:types.Optional[types.Numeric]=None,
-
center:types.Optional[types.Sequence]=None,
-
aspect_scale:types.Numeric=0.75,
-
bounding_coords:types.Optional[types.Sequence
-
[types.Numeric]]=None,
-
min_scale_limit:types.Optional[types.Numeric]
-
=None,
-
max_scale_limit:types.Optional[types.Numeric]
-
=None,
-
name_property:str="name",
-
selected_mode:types.Union[boolstr]=False,
-
layout_center:types.Optional[types.Sequence
-
[str]]=None,
-
layout_size:types.Union[strtypes.Numeric]=None,
-
label_opts:types.Label=None,
-
itemstyle_opts:types.ItemStyle=None,
-
emphasis_itemstyle_opts:types.ItemStyle=None,
-
emphasis_label_opts:types.Label=None):
-
self.js_dependencies.add(maptype)
-
if center:
-
assert len(center) == 2
-
scale_limit = {
-
"min":min_scale_limit,
-
"max":max_scale_limit}
-
if min_scale_limit is None and max_scale_limit is
-
None:
-
scale_limit = None
-
self.options.update(
-
geo={
-
"map":maptype,
-
"zoom":zoom,
-
"center":center,
-
"roam":is_roam,
-
"aspectScale":aspect_scale,
-
"boundingCoords":bounding_coords,
-
"scaleLimit":scale_limit,
-
"nameProperty":name_property,
-
"selectedMode":selected_mode,
-
"layoutCenter":layout_center,
-
"layoutSize":layout_size,
-
"label":label_opts,
-
"itemStyle":itemstyle_opts,
-
"emphasis":{
-
"itemStyle":emphasis_itemstyle_opts,
-
"label":emphasis_label_opts}})
-
return self
文章来源: yunyaniu.blog.csdn.net,作者:一个处女座的程序猿,版权归原作者所有,如需转载,请联系作者。
原文链接:yunyaniu.blog.csdn.net/article/details/109732212
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)