How can insert PNG image as marker and remove transparent region?
Show older comments
Hey,
I was trying to insert a .png image as a marker into my plot. I am aware that to insert a image as marker you need find xdata/ydata and use hold to insert image into original plot. I was able to do that but I couldn't manage to show only the image, white-grey part is still there. What I want is to remove this white-grey part and only show the aircraft as marker.
My code: (marker position needs to be updated but this is good enough for testing)
clc
clear
x = linspace(1,10,20);
y = linspace(1,10,20);
[cdata,colormap] = imread("f16.png");
figure
hold on
p = scatter(x,y);
xdata = p.XData;
ydata = p.YData;
% imshow(cdata,colormap)
%
ax2 = axes("Position",[xdata(1,4)/10,ydata(1,4)/10,0.1,0.1]);
imshow(cdata,colormap,Parent=ax2);

Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic 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!