2. 有数组data =np.arange(0,1.1,0.01),在matplotlib中绘制如图所示图形
时间: 2024-04-21 09:27:26 浏览: 64
解决matplotlib.pyplot在Jupyter notebook中不显示图像问题
好的,下面是利用matplotlib绘制所示图形的程序:
```python
import matplotlib.pyplot as plt
import numpy as np
data = np.arange(0,1.1,0.01)
plt.plot(data, data**2, label='y=x^2')
plt.plot(data, data**3, label='y=x^3')
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.title('Plot of y=x^2 and y=x^3')
plt.legend()
plt.show()
```
运行该程序,可以得到如下图形:
![plot](https://img-blog.csdn.net/20180604205450310?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2pxb3JkX3N0b3Jl/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/q/75)
阅读全文