How can i insert a picture at a specific coordinate in a graph?
Show older comments
For example if i want a graph of x=1:10, y=1:10, and instead of the dots that symbolize the points i want to have a specific icon that i have on my computer. Thanks!
Answers (1)
clc; clear all
% your data
x=1:10;
y=1:10;
plot(x,y,'.-r');
hold on;
%
dx = 0.5 ; dy = 0.5 ; % size of the image/ icon
xmin = x-dx ; xmax = x+dx ;
ymin = y-dy ; ymax = y+dy ;
% Make background transperent
[img, map, alpha] = imread('MATLAB.png');
img = flipud(img) ;
for i = 1:length(x)
h = image([xmin(i) xmax(i)],[ymin(i) ymax(i)],img); %# P`lot the image
set(h,'AlphaData',0.5);
end

Categories
Find more on Software Development 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!