
How can i insert a picture at a specific coordinate in a graph?
16 views (last 30 days)
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!
0 Comments
Answers (1)
KSSV
on 6 Jun 2016
Edited: KSSV
on 6 Jun 2016
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

0 Comments
See Also
Categories
Find more on Mapping Toolbox 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!