掃二維碼與項目經(jīng)理溝通
我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流
1、安裝所需庫:matplotlib

2、導入所需庫:import matplotlib.pyplot as plt
1、創(chuàng)建x軸數(shù)據(jù):x = np.linspace(2 * np.pi, 2 * np.pi, 100)
2、計算y軸數(shù)據(jù):y = np.sin(x)
3、使用plt.plot()繪制圖像:plt.plot(x, y)
4、設置圖像標題和坐標軸標簽:plt.title("正弦函數(shù)圖像"), plt.xlabel("x軸"), plt.ylabel("y軸")
5、顯示圖像:plt.show()
import numpy as np
import matplotlib.pyplot as plt
創(chuàng)建x軸數(shù)據(jù)
x = np.linspace(2 * np.pi, 2 * np.pi, 100)
計算y軸數(shù)據(jù)
y = np.sin(x)
繪制圖像
plt.plot(x, y)
設置圖像標題和坐標軸標簽
plt.title("正弦函數(shù)圖像")
plt.xlabel("x軸")
plt.ylabel("y軸")
顯示圖像
plt.show()
運行上述代碼,將生成一個正弦函數(shù)圖像。

我們在微信上24小時期待你的聲音
解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流