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

5 次查看(过去 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 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by