How to set background image for changing plot without using hold on/off?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BananaBandana
el 24 de Nov. de 2021
Comentada: BananaBandana
el 24 de Nov. de 2021
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
0 comentarios
Respuesta aceptada
DGM
el 24 de Nov. de 2021
Editada: DGM
el 24 de Nov. de 2021
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!