python:plotly 网页交互式数据可视化工具

pip install plotly

plotly-5.22.0-py3-none-any.whl

pip install plotly_express

包含:GDP数据、餐厅的订单流水数据、鸢尾花 Iris数据集 等等

pip show plotly

Name: plotly

Version: 5.22.0

Summary: An open-source, interactive data visualization library for Python

Home-page: https://plotly.com/python/

Author: Chris P

编写 test_plotly_express.py 如下

python 复制代码
# -*- coding: utf-8 -*-
""" 旭日图 """
import plotly
import plotly.express as px

gap = px.data.gapminder()
gap.head()
gap.tail()

# 选取 2007年数据
gap_2007 = gap[gap["year"] == 2007 ]
obj = px.sunburst(gap_2007, # 绘图数据
            path=['continent', 'country'], # 指定路径:从大洲到国家
            values='pop',   # 数值:人口数
            color='lifeExp', # 颜色
            hover_data=['iso_alpha'] # 显示数据
            )
obj.show()

Anaconda 3 点击 【Jupyter Notebook】运行上面脚本,可见

相关推荐
幻影123!6 小时前
从零训练一个会下五子棋的AI
python·深度学习·神经网络·强化学习·五子棋·alpha zero·mokugo
Python私教8 小时前
Django 接入 AI 大模型实战:从零做一个流式聊天网站
人工智能·python·django
Python私教8 小时前
Django 接入 MCP 实战:让 AI 安全调用数据库和业务接口
人工智能·python·django
Python私教8 小时前
Django 搭建 AI 本地知识库:文档上传、向量检索与智能问答
人工智能·python·django
always_TT9 小时前
【Python 日志记录:logging 模块入门】
开发语言·python·php
lipku11 小时前
数字人直播开源项目LiveStream
python·开源·数字人·数字人直播
阿童木写作11 小时前
Python实现亚马逊商品图批量智能抠图教程
人工智能·python
axinawang12 小时前
第24课:while循环的应用
python
三亚兴嘉装饰12 小时前
三亚服装店装修
python
小柯南敲键盘12 小时前
速卖通AI图片翻译API集成实战
人工智能·python