用python 生成的简单的图形图表

   import matplotlib.pyplot as plt
   #x轴的值
   input_values=[1,2,3,4,5]
   #y轴的值
   squares =[1,4,9,16,25]
  #执行生成图表的方法
   plt.plot(input_values,squares,linewidth=5)
  #设置标题
   plt.title("Square Numbers" ,fontsize=24)
  #设置x轴的描述
  plt.xlabel("Value",fontsize=14)
  #设置y的描述
  plt.ylabel("Square of Value",fontsize=14)
  plt.tick_params(axis='both',labelsize=14)
  #生成的图标显示

  plt.show()

运行结果:






猜你喜欢

转载自blog.csdn.net/a289237642/article/details/79991329
今日推荐