#!/usr/bin/python # -*- coding: UTF-8 -*- import matplotlib.pyplot as plt #绘制散点图 def drawScatter(heights,weights): #创建散点图 #第一个参数为点的横坐标 #第二个参数为点的纵坐标 plt.scatter(heights,weights) plt.xlabel('Heights') plt.ylabel('Weight') plt.title('Heights & Weight of Students') plt.show() if __name__ == '__main__': heights = [1.5, 1.7] weights = [43, 61] drawScatter(heights,weights)