使用修改后的轴从imshow()标记图像上的点

2024-09-27 09:23:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题很简单。我使用imshow()可视化二维数组,并修改其轴标记和标签。现在,如果我需要在“新”原点上放置一个标记,我该怎么做?如您所见,标记仍然位于原始原点的上方

plt.imshow(vel_meshXY) #vel_meshXY is a 2D array. Image shown below.

# Manipulating the axis ticks and axis tick labels here. 
ax=plt.gca()
ax_labelLoc = np.arange(0,num_steps, 40); ax.set_xticks(ax_labelLoc); ax.set_yticks(ax_labelLoc)
ax.set_xticklabels(np.linspace(turbine_origin[0]-minusX, turbine_origin[0]+plusX, num_steps)[ax_labelLoc])
ax.set_yticklabels(np.linspace(turbine_origin[1]+plusY, turbine_origin[1]-minusY, num_steps)[ax_labelLoc])

# trying to put a marker wrt the 'new' origin 
ax.plot(10, 10, 'o', markersize= 10, color = 'r')


enter image description here


Tags: the标记nppltoriginaxstepsnum

热门问题