1, pyplot 实例

  1. %matplotlib inline
  2. import pandas as pd
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5. x = np.linspace(0, 2, 100)
  6. plt.plot(x, x, label='linear')
  7. plt.plot(x, x**2, label='quadratic')
  8. plt.plot(x, x**3, label='cubic')
  9. plt.xlabel('x label')
  10. plt.ylabel('y label')
  11. # plt.xlim([0,2])
  12. # plt.ylim([0, 8])
  13. plt.title("title")
  14. plt.legend(loc='upper left')
  15. plt.show()

image.png