How to change Y-axis coordinates of meshgrid
이전 댓글 표시
Hello Everyone, i hope you are doing well. I am creating binary Image in which background is black and forground is white
when i create grid of 1000x1000. The X-axis start from 0 to 1000 but Y axis is upper side 0 to 1000 as you can see in the following image , but i want Y axis to be start from Lower 0 to 1000
How can i do that in MATLAB

imSz = 1000; % assuming images are 1000x1000
imbg = false(imSz); % background "color"
imfg = ~imbg(1,1);
[~,Y] = meshgrid(1:imSz); % make a grid
% black and white image
BW = imbg;
imshow(BW)
axis on;
채택된 답변
추가 답변 (2개)
KSSV
2022년 3월 20일
>> hax = gca;
hax.YTickLabel = flipud(hax.YTickLabel);
댓글 수: 3
Med Future
2022년 3월 20일
KSSV
2022년 3월 20일
[~,Y] = meshgrid(imSz:-1:1); % make a grid
Med Future
2022년 3월 20일
imSz = 1000; % assuming images are 1000x1000
imbg = false(imSz); % background "color"
imfg = ~imbg(1,1);
[~,Y] = meshgrid(1:imSz); % make a grid
% black and white image
BW = imbg;
imshow(BW)
axis on;
axis xy
댓글 수: 2
Med Future
2022년 3월 21일
yanqi liu
2022년 3월 22일
yes,sir,use axis xy to make the coordinate as norma xy axis, not use image axis
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

