暫無描述

mpl_squares.py 372B

12345678910111213141516
  1. import matplotlib.pyplot as plt
  2. input_values = [1, 2, 3, 4, 5]
  3. squares = [1, 4, 9, 16, 25]
  4. plt.plot(input_values, squares, linewidth=5)
  5. # Set chart title and label axes.
  6. plt.title("Square Numbers", fontsize=24)
  7. plt.xlabel("Value", fontsize=14)
  8. plt.ylabel("Square of Value", fontsize=14)
  9. # Set size of tick labels.
  10. plt.tick_params(axis='both', labelsize=14)
  11. plt.show()