Change the axis scale of imshow

…衆ロ難τιáo~ 提交于 2019-12-02 06:55:55

问题


I'm visualizing a matrix in MATLAB with imshow. However, I'd like the y and x axis to switch places, making x correspond to the row-index of the matrix, and y correspond to the col-index.

I also want to change the increment value of the axises to 0.01, so that row 10 has x value 0.1, row 100 has 1 and so on.


回答1:


To swap the axes you will want to change the view of the axes. By default the 2D view has the y axis vertical and x axis horizontal. You can change this by rotating the view 90 degrees.

view(-90,90)   % Default is view(0, 90)

To change the increment, you will want to alter the XData and YData of the image object returned by imshow.

him = imshow(img, []);
set(him, 'XData', [0, size(img, 2)/100], 'YData', [0, size(img, 1)/100]);



来源:https://stackoverflow.com/questions/35946466/change-the-axis-scale-of-imshow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!