From f61858eea00b52509b9a98a8b6b278447d349b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BF=97=E6=B5=A9?= <392219358@qq.com> Date: Tue, 5 Dec 2023 06:25:07 +0000 Subject: [PATCH] =?UTF-8?q?add=2003-=E8=AF=BE=E7=A8=8B=E5=AE=9E=E9=AA=8C/C?= =?UTF-8?q?S2101007/=E9=A1=B9=E7=9B=AE=E4=BB=A3=E7=A0=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 吴志浩 <392219358@qq.com> --- ...1\271\347\233\256\344\273\243\347\240\201" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "03-\350\257\276\347\250\213\345\256\236\351\252\214/CS2101007/\351\241\271\347\233\256\344\273\243\347\240\201" diff --git "a/03-\350\257\276\347\250\213\345\256\236\351\252\214/CS2101007/\351\241\271\347\233\256\344\273\243\347\240\201" "b/03-\350\257\276\347\250\213\345\256\236\351\252\214/CS2101007/\351\241\271\347\233\256\344\273\243\347\240\201" new file mode 100644 index 0000000..c239a4b --- /dev/null +++ "b/03-\350\257\276\347\250\213\345\256\236\351\252\214/CS2101007/\351\241\271\347\233\256\344\273\243\347\240\201" @@ -0,0 +1,26 @@ +import matplotlib.pyplot as plt + +# 模拟数据 +channel_labels = ['搜索引擎', '直接访问', '社交媒体', '邮件营销'] +channel_data = [30, 25, 20, 25] + +plt.pie(x=channel_data, labels=channel_labels, autopct='%1.1f%%') +plt.title('用户来源渠道分布情况') +plt.show() +import plotly.express as px +import pandas as pd + +# 模拟数据 +df = pd.DataFrame({ + 'state': ['北京市', '上海市', '江苏省', '浙江省', '广东省', '四川省'], + 'users': [30, 25, 20, 10, 8, 7] +}) + +fig = px.choropleth(df, + locations='state', # 坐标轴数据源 + locationmode='CN-provinces', # 坐标轴数据源地理位置信息 + color='users', # 颜色 + scope='asia', # 区域 + title='用户来源地区分布情况' + ) +fig.show() \ No newline at end of file -- Gitee