pandas中绘制图像,图像中带有x^2,可以表示出来

  • Post author:
  • Post category:其他


import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-100, 100, 1000)
y1 = x
y2 = x ** 2
y3 = 3 * x ** 3 + 5 * x ** 2 + 2 * x + 1

print(y1)
print(y2)
print(y3)

plt.plot(x, y1, 'o-r', label='y=x')
plt.plot(x, y2, 'o:g', label='y=$x^2$')
plt.plot(x, y3, 'o-.b', label='y=3*$x^3$+5*$x^2$+2*x+1')
plt.ylim(-1000, 1000)
plt.legend()
plt.show()

在这里插入图片描述



版权声明:本文为m0_46689661原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。