필터 지우기
필터 지우기

Add a .png Image multiple times in a graph

조회 수: 1 (최근 30일)
Pietro Fedrizzi
Pietro Fedrizzi 2021년 11월 5일
댓글: Pietro Fedrizzi 2021년 11월 5일
Hello everyone.
In my matlab code I have a graph like this one.
I implemented these lines of code so that I'm able to display a certain image in my graph in a specific position.
[img, ~, tr] = imread('ancora.png');
im = image('CData',img,'XData',[-0.3 0.5],'YData',[-0.3 0.5]);
im.AlphaData = tr;
However, I need to insert that specific figure multiple times in my graph in specific points, but I'm struggling to do so.
How can I insert that Image multiple times in my graph in the positions that I want?

채택된 답변

Dave B
Dave B 2021년 11월 5일
You can call image multiple times, specifying your x and y separately with a few caveats:
  • You'll need hold on to prevent wiping out the axes on each call.
  • image sets the x and y limits the first time you call it, and doesn't set them again on future calls. You can set your limits manually to whatever values you want, or just use 'axis tight' (or 'axis padded') for convenience.
im=imread('peppers.png');
image([1 20],[1 25],im)
hold on
image([40 60],[50 75],im)
image([10 30],[30 55],im)
axis tight
  댓글 수: 1
Pietro Fedrizzi
Pietro Fedrizzi 2021년 11월 5일
Works great!
Thanks for your time and help!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by