pyecharts怎么绘制散点图_pyecharts可视化和wx的结合
前言
最近在研究 pyecharts 的用法,它是 python 的一個可視化工具,然后就想著結合微信來一起玩
不多說,直接看效果:
條形圖.gif
環境配置
pip install pyecharts
pip install snapshot_selenium
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
pip install echarts-china-counties-pypkg
pip install wxpy
獲取好友
主要是獲取好友基本數據,用來做數據可視化
代碼如下:
from wxpy import Bot, Chat
class Demo(Chat):
@staticmethod
def get_friend():
bot = Bot()
friends = bot.friends(update=True)
friend_data = []
for friend in friends:
if friend.sex == 1:
sex = "男"
elif friend.sex == 2:
sex = "女"
else:
sex = ""
friend_dict = {
"city": friend.city,
"province": friend.province,
"sex": sex,
"signature": friend.signature,
}
friend_data.append(friend_dict)
return friend_data
地理坐標圖
地理坐標系組件用于地圖的繪制,支持在地理坐標系上繪制散點圖,線集。在 pyecharts 中地理坐標圖主要是基于 Geo 模塊
def geo_base():
city_data = get_data()
geo = Geo(init_opts=opts.InitOpts(theme="vintage"))
for city in city_data:
try:
geo.add_schema(maptype="china
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的pyecharts怎么绘制散点图_pyecharts可视化和wx的结合的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java同步锁实例_Java lock同
- 下一篇: c c mySQL机票设计_期末课程设计