Graph Not Showing Up When Using Google Colabratory 在使用Google Colabratory时,图表无法显示出来。
Graph Not Showing Up When Using Google Colabratory 在使用Google Colabratory时,图表无法显示出来。
我正在尝试使用numpy和matplotlib.pyplot在Google Colabratory中绘制一个剪力图,但是它在输出部分没有显示出来。我的代码如下:\n
import matplotlib.pyplot as plt import numpy as np # 创建图表 x = np.linspace(0, d_OA + d_AB + d_BC, 1000) V_xy = np.zeros_like(x) for idx, loc in enumerate(x): if loc < d_OA: V_xy[idx] = R_oy elif ((loc >= d_OA) and (loc < d_OA + d_AB)): V_xy[idx] = R_oy - T_A*np.sin(theta_A) elif ((loc >= d_OA + d_AB) and (loc < d_OA + d_AB + d_BC)): V_xy[idx] = R_oy - T_A*np.sin(theta_A) - W*np.sin(theta_B) else: V_xy[idx] = R_oy - T_A*np.sin(theta_A) - W*np.sin(theta_B) + R_cy V_xy[0] = 0 # 绘制图表 plt.plot(x, V_xy, '-') plt.grid(True) plt.xlabel('x / m') plt.ylabel('Vxy / N')
\n如果有人能帮忙,我会非常感激。