필터 지우기
필터 지우기

Insert image as a marker in plot

조회 수: 47 (최근 30일)
Hülya Sukas
Hülya Sukas 2019년 9월 19일
댓글: Vartika Agarwal 2021년 5월 17일
Hello everyone,
I want to plot ship trajectory. Instead of using defult markers, I want to use a simple ship icon like shown below.
Is it possible to that?
Thanks in advance.

답변 (1개)

Harsha Priya Daggubati
Harsha Priya Daggubati 2019년 9월 23일
Hi,
You can try executing this code by loading the png image into your workspace.
x = 1:10;
y = 5*rand(size(x)) + 2.5;
[marker,m] = imread('images.png');
marker = imresize(marker,0.5);
markersize = [1,1]; %//The size of marker is expressed in axis units, NOT in pixels
x_low = x - markersize(1)/2; %//Left edge of marker
x_high = x + markersize(1)/2;%//Right edge of marker
y_low = y - markersize(2)/2; %//Bottom edge of marker
y_high = y + markersize(2)/2;%//Top edge of marker
for k = 1:length(x)
imagesc([x_low(k) x_high(k)], [y_low(k) y_high(k)],marker)
hold on
end
axis equal
hold off
Hope this helps!
  댓글 수: 1
Vartika Agarwal
Vartika Agarwal 2021년 5월 17일
This is the image i want to use it instead of * . I use above code but it does not work. Please help

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by