- 散点图:
不同条件(维度)之间的内在关联关系
观察数据的离散聚合程度
@desc:寻找出气温和随时间(天)变化的某种规律
"""
from matplotlib import pyplot as plt
from matplotlib import font_manager
my_font = font_manager.FontProperties(fname="/System/Library/Fonts/PingFang.ttc")
y_3 = [11,17,16,11,12,11,12,6,6,7,8,9,12,15,14,17,18,21,16,17,20,14,15,15,15,19,21,22,22,22,23]
y_10 = [26,26,28,19,21,17,16,19,18,20,20,19,22,23,17,20,21,20,22,15,11,15,5,13,17,10,11,13,12,13,6]
x_3 = range(1,32)
x_10 = range(51,82)
fig = plt.figure(figsize=(20,8),dpi=80)
plt.scatter(x_3,y_3,label="3月份")
plt.scatter(x_10,y_10,label="10月份")
x_ticks = list(x_3) + list(x_10)
x_labels = ["3月{}日".format(i) for i in x_3]
x_labels += ["3月{}日".format(i-50) for i in x_10]
plt.xticks(x_ticks[::3], x_labels[::3], fontproperties=my_font,rotation=45)
plt.legend(prop=my_font,loc="upper left")
plt.ylabel("温度(°C)",fontproperties=my_font)
plt.title("3月和10月每日温度",fontproperties=my_font,fontsize=20)
plt.show()
![在这里插入图片描述](https://img-blog.csdnimg.cn/1a89289efa8a4498b085381b13597967.png#pic_center)
- 条形图:
• 数量统计
• 频率统计(市场饱和度)