【发布时间】:2020-11-27 09:14:08
【问题描述】:
我已经给出了以下矩形,我想将其转换(给定 ax 和 M)对应于转换矩阵 M。我的问题是矩阵“线”和“M”具有不同的维度。
lines = np.array([[-1, 1, 1, -1, -1], [-1, -1, 1, 1, -1]])
basis = np.array([[1, 0], [0, 1]])
# Transform lines and basis using M
ax = M.dot(lines.T) # This is my attempt to transform the axis
ax.plot( lines[0,:], lines[1,:], '-', color="gray" )
ax.arrow( 0, 0, basis[0][0], basis[1][0], color='red', width=.04, length_includes_head=True )
ax.arrow( 0, 0, basis[0][1], basis[1][1], color='gold', width=.04, length_includes_head=True )
ax.set_xlim( -5, 5 )
ax.set_ylim( -5, 5 )
ax.grid()
我希望我已经足够清楚地指出了我的问题。
【问题讨论】:
标签: python numpy matrix transpose