MATLAB: How to plot two colorbars in isosurface figure

colorbarisosurface

I want to plot two isosurface in one figure :Z1,Z2
isovalues1 = 0:0.1:1;
for i=1:length(isovalues1)
isosurface(X,Y,Z,Z1,isovalues1(i));
end
hc(1,1)=colorbar;
hc(1,1).Limits = [0 1];
hold on
ax = gca;
isovalues2 = 40:10:100;
for i=1:length(isovalues2)
isosurface(X,Y,Z,Z2,isovalues2(i));
end
hc(1,2)=colorbar;
hc(1,2).Limits = [40 100];
I don't know why this does not work properly. colorbar ranges are [0 1], [40 100] but they shows only one colorbar limits [0 100] How can I fix it?

Best Answer

You need to hold after the first isosurface for each axes
Each axes can have only one colorbar