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 如下
# -*- coding: utf-8 -*-
""" 旭日图 """
import plotly
import plotly.express as pxgap = 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】运行上面脚本,可见