项目 数据可视化2

 1 import matplotlib.pyplot as plt
 2 
 3 x_values=[1,2,3,4,5]
 4 y_values=[1,4,9,16,25]
 5 
 6 plt.scatter(x_values,y_values,s=100)
 7 # 设置图表标题,并给坐标轴加上标签
 8 plt.title("Squares Numbers",fontsize=24)
 9 plt.xlabel("Value",fontsize=14)
10 plt.ylabel("Square of Value",fontsize=14)
11 # 设置刻度标记的大小
12 plt.tick_params(axis='both',which='major',labelsize=14)
13 
14 plt.show()

 1 import matplotlib.pyplot as plt
 2 
 3 x_values=list(range(1,1001))
 4 y_values=[x**2 for x in x_values]
 5 
 6 plt.scatter(x_values,y_values,s=100)
 7 # 设置图表标题,并给坐标轴加上标签
 8 plt.title("Squares Numbers",fontsize=24)
 9 plt.xlabel("Value",fontsize=14)
10 plt.ylabel("Square of Value",fontsize=14)
11 # 设置刻度标记的大小
12 plt.tick_params(axis='both',which='major',labelsize=14)
13 
14 plt.show()

import matplotlib.pyplot as plt

x_values=list(range(1,1001))
y_values=[x**2 for x in x_values]

plt.scatter(x_values,y_values,s=40)
# 设置图表标题,并给坐标轴加上标签
plt.title("Squares Numbers",fontsize=24)
plt.xlabel("Value",fontsize=14)
plt.ylabel("Square of Value",fontsize=14)

plt.axis([0,1100,0,1100000])

plt.show()

猜你喜欢

转载自www.cnblogs.com/zhulvbo/p/8921350.html
今日推荐