How to set background image for changing plot without using hold on/off?

조회 수: 18 (최근 30일)
Hey Guys!
I have simulated the heat transfer in a Turbine Injector and save the corresponding temperatures for many timesteps in a matrix. I now want to plot this matrix succesively for different timesteps to show the evolution of the heat. However, behind this plot I want to show a picture of the 2D Drawing of the Injector so that you can see where actually the heat is flowing to.
The code shown here works but obviously in this case the drawing of the injector gets replaced by the plotting of the matrix. If I use hold on/off however, the drawing of the injector stays but all the imagesc-plots are overlaid, which I also don't want.
Any ideas?
Thanks so much!
% hold on?
imshow(drawing_2D_injector);
for i = 1:num %timesteps
for j = 1:39
a = coords{j}; % in coords the coordinates of the flow areas are saved
A(a) = B(i,j); % in B the temperatures are saved
end
colormap(jet);
imagesc(A,'AlphaData',0.7);
drawnow
pause(0.1)
end

채택된 답변

DGM
DGM 2021년 11월 24일
편집: DGM 2021년 11월 24일
I suppose this is one way. I'm sure there are others.
imshow('peppers.png');
hold on % use hold
for i = 1:5 % placeholder value
A = imresize(randn(20,20),[384 512]); % test overlay
colormap(jet);
if i ~= 1; delete(himg); end % but delete any prior overlays
himg = imagesc(A,'AlphaData',0.7);
drawnow
pause(0.1)
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by