import matplotlib.pyplot as plt squares = [1, 4, 9, 16, 34] plt.plot(squares) plt.show()
3. 校正图形
import matplotlib.pyplot as plt input_values = [1, 2, 3, 4, 5] squares = [1, 4, 9, 16, 25] plt.plot(input_values, squares, linewidth=5) # linewidth决定了线条的粗细 # 设置图表标题,并给坐标轴加上标签 plt.title(‘Square Numbers‘, fontsize=24) plt.xlabel("Value", fontsize=14) plt.ylabel(‘Square of value‘, fontsize=14) plt.show() # 设置刻度标记的大小 plt.tick_params(axis=‘both‘, labelsize=14)
原文:https://www.cnblogs.com/endian11/p/9070940.html