The pixel size of an image doesn't match the axis scale

5 ビュー (過去 30 日間)
MCC
MCC 2020 年 11 月 29 日
コメント済み: MCC 2020 年 11 月 30 日
I plot an image, which is shown below. According to the X axis scale, the legth of red line is 0.5. And the black line is the same length as red line. So, the total length of this two lines is 1. If you look the the X axis, the total length of the two line is close to 2.5, which does not match the X axis dimension.
My question is that can we change the dimension of the piexl so that pixel size of an image match the axis scale.
Thanks,
MCC
  4 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 11 月 29 日
No, it is not so, scale specifies the indices, and the color bar refers to the pixel value. Please see the following, where 0–2 and 2–4 are different scales.
How did you set the x scale, is it the default or tick label?
MCC
MCC 2020 年 11 月 30 日
No, it's not the default. Please find the code and data in the attachment.
Thank you,
MCC

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2020 年 11 月 29 日
Since the distance between tick marks is 2, and the left one is at 0.5, then the left edge of the image is at X = (0.5 - 2) = -1.5.
So the red line is about 2 long, and the gray line is around 1.8 long and the total of the two lines is about 2 + 1.8 = 3.8 long.
Did you use 'XData' and 'YData' in imshow when you displayed it?
imshow(yourImage, 'XData', [xmin, xmax], 'YData', [ymin, ymax]);
  1 件のコメント
MCC
MCC 2020 年 11 月 30 日
Thanks for your reply. I tried this but it doesn't work. I have attached the code and data. Thanks again.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by