How can i use scatter with an image
22 views (last 30 days)
Show older comments
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 Comments
KSSV
on 24 May 2017
There is a miss match with the scatter points data and image data....you must tell what you are expecting?
Answers (1)
Walter Roberson
on 24 May 2017
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.
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!