How can i insert a picture at a specific coordinate in a graph?

16 ビュー (過去 30 日間)
Daniella Apelblat
Daniella Apelblat 2016 年 6 月 6 日
編集済み: KSSV 2016 年 6 月 6 日
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!

回答 (1 件)

KSSV
KSSV 2016 年 6 月 6 日
編集済み: KSSV 2016 年 6 月 6 日
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

カテゴリ

Help Center および File ExchangeMapping Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by