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 0000000000000000000000000000000000000000..c239a4b699c234c9387273a7131a3ca3f06fdc9f --- /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