How can i use scatter with an image

조회 수: 12 (최근 30일)
Alex
Alex 2017년 5월 24일
댓글: Alex 2017년 5월 24일
I have had either all the points plot correctly the colors distorted/scaled by the image they were plotted over, OR the scatter plot colors scaled correctly, but plotted incorrectly.
This produces Fig 1
figure, imshow(img, 'InitialMag',100, 'Border','tight'), hold on
scatter(mx, my, pointsize, TEC)
hold off
This gives Fig 2:
figure
ax = gca();
scatter(mx, my, pointsize, TEC)
freezeColors(ax);
hold(ax, 'on');
imz = imshow(img, 'InitialMag',100, 'Border','tight');
hold(ax, 'off')
uistack(imz, 'bottom')
  댓글 수: 2
KSSV
KSSV 2017년 5월 24일
There is a miss match with the scatter points data and image data....you must tell what you are expecting?
Alex
Alex 2017년 5월 24일
I want the positions of the scatter points to remain the same as Fig 1, but want the color scale to be frozen like in Fig 2. Fig 3 shows to coordinates of the scattered points. The image coordinates are shown in Fig 4.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 24일
Your (x, y) coordinates have both positive and negative y. However, by default images are assigned positive coordinates by row and column offsets.
You should use the imshow() XData and YData options to place the image within the x y coordinate space. You will probably need to look at the documentation of image() to understand XData and YData.
  댓글 수: 1
Alex
Alex 2017년 5월 24일
I took a look at the documentation but all it really tells me is that, "Y-axis limits of nondefault coordinate system, specified as the comma-separated pair consisting of 'YData' and a two-element vector. The value can have more than two elements, but imshow uses only the first and last elements.
Example: 'YData',[100 200]"
since my x and y data are latitude and longitude, I try:
imz = imshow(img, 'InitialMag',100, 'Border','tight', 'XData',[0 360], 'YData',[-90 90]);
This gives Fig 5.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by