How to layer static and animated surface subplots in the same graph with different colours

조회 수: 5 (최근 30일)
Hello,
I am trying to represent vessel grid point (in the sense that there can either be a vessel in form of a red point or not [matrix or ones and zeros]) and movement of cells in the same surface plot. This surface plot is a subplot of four (each of these will be updated, one after the next, 1000 times through the simulation).
While the vessel plot is static, the cell movement plot needs updated (1000 times in total). There can be 0 to 4 cells in a grid point at any point in time and the legend adjusts accordingly. So the moving cell part currently has the following code:
figure1=figure('units','normalized','outerposition',[0 0 1 1]);
set(gcf,'color','w');
for n = 0:999
subplot(2,2,1)
c=strcat('/Users/lcf4/Desktop/lf-cells-xcode/OutputFiles/z_text',num2str(n),'.txt');
a=dlmread(c);
PCC=a(:,101:200);
surf1 = surf(PCC);
axis([1 101 1 101])
axis square
colorbar ('southoutside')
view([0 90])
grid off
shading flat
title(['...'])
drawnow;
{...OTHER SUBPLOTS...}
It produces something like the screen shot attached (1000 versions of it).
The vessel code is as follows:
figure0=figure('units','normalized','outerposition',[0 0 1 1]);
set(gcf,'color','w');
for n = 0:0
subplot(2,2,1)
c=strcat('/Users/lcf4/Desktop/lf-cells-xcode/OutputFiles/z_text',num2str(n),'.txt');
a=dlmread(c);
PCC=a(:,1601:1700);
surf(PCC)
axis([1 101 1 101])
axis square
colorbar ('southoutside')
view([0 90])
grid off
shading flat
title(['Vessels Primary Grid'])
drawnow;
{...OTHER SUBPLOTS...}
I tried combining the two like this:
figure1=figure('units','normalized','outerposition',[0 0 1 1]);
set(gcf,'color','w');
for n = 0:999
subplot(2,2,1)
c=strcat('/Users/lcf4/Desktop/lf-cells-xcode/OutputFiles/z_text',num2str(n),'.txt');
a=dlmread(c);
PCC=a(:,101:200);
surf1 = surf(PCC);
axis([1 101 1 101])
axis square
colorbar ('southoutside')
view([0 90])
grid off
shading flat
title(['Cells'])
drawnow;
hold on;
subplot(2,2,1)
c=strcat('/Users/lcf4/Desktop/lf-cells-xcode/OutputFiles/z_text',num2str(n),'.txt');
a=dlmread(c);
PCC=a(:,1701:1800);
surf2 = surf(PCC)
alpha(BICC, 0.1);
axis([1 101 1 101])
axis square
colorbar ('southoutside')
view([0 90])
grid off
shading flat
title(['Vessels Brain Grid'])
drawnow;
I also tried my luck with removing the "drawnow"s but cannot get it to work...
What I want it a static vessel image with red vessels and then the cells moving around on the same grid.
I hope this is clear—thanks for any suggestions!!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by