我正在嘗試繪制 numpy 陣列x_train 和y_train. 我正在使用 matplotlib 的plot 函式,我想傳遞一個引數來增加資料點的大小。這是我的代碼:
x_train = np.array([0. , 0.10526316, 0.21052632, 0.31578947, 0.42105263,
0.52631579, 0.63157895, 0.73684211, 0.84210526, 0.94736842,
1.05263158, 1.15789474, 1.26315789, 1.36842105, 1.47368421,
1.57894737, 1.68421053, 1.78947368, 1.89473684, 2. ])
y_train = np.array([0.2260415, 0.08966768, -0.02649684, -0.1024971, 0.14580953,
0.03593453, 0.14398569, 0.30298584, 0.51058752, 0.43602841, 0.50852418,
1.05403315, 1.27155675, 1.38071476, 1.62995731, 1.6434204, 1.64367346,
1.54763514, 1.47964281, 0.97544995])
plt.figure(figsize=(20,10))
plt.plot(x_train, y_train, '*', color='black', label='Train values with noise')

uj5u.com熱心網友回復:
使用markersize(快捷鍵:)ms:
plt.plot(x_train, y_train, '*', color='black', label='Train values with noise', ms=12)

uj5u.com熱心網友回復:
使用 'markersize' 作為點的大小,如示例所示:
plt.plot(x_train, y_train, '*', color='black', label='Train values with noise', markersize = 20)
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/394383.html
標籤:Python matplotlib 阴谋
上一篇:在同一軸和繪圖上繪制模型
