我有一个图像,我正在使用pyfits加载到2D数组中。我想在图像上画一条穿过两个像素的线,并用添加的新线保存它(不是绘图)。在这之后,我想用不同的颜色画一条垂直于前一条线的线。使用matplotlib实现这一点的最佳方法是什么?我用皮尔试过了。我没能做到。请看一下代码并建议我一种方法。我也附上了图片def plotAxes(map, angle, x_centroid, y_centroid):
hor = math.floor(x_centroid + 20*(math.cos(angle)))
ver = math.floor(y_centroid - 20*(math.sin(angle)))
hor1 = math.floor(x_centroid + 20*(math.cos(angle+90.0)))
ver1 = math.floor(y_centroid - 20*(math.sin(angle+90.0)))
map_height = len(map)
map_width = len(map[0])
point = [ver, hor]
center = [y_centroid, x_centroid]
Max = np.max(map)
array = np.zeros((map_height, map_width), int)
for i in range(0, map_height):
for j in range(0, map_width):
array[i][j] = (math.floor((float(map[i][j])/float(Max))*255))
im = Image.fromarray(np.uint8(array))