Filled contour plot colormap
이전 댓글 표시
Dear MATLAB users,
I would like to plot 3D data as a contour plot but struggle with colorbar/colormap settings.
Using R2017a, following code creates a filled 2D contour plot but for z =0 it assigns same color as for z=1.
[X,Y] = meshgrid(0:0.5:10);
Z = X + Y;
z_int=fix(Z/2);
max_z_int=max(max(z_int));
min_z_int=min(min(z_int));
contourf(X,Y,z_int,max_z_int-min_z_int);
colormap(parula(max_z_int-min_z_int))
c=colorbar;
caxis([min_z_int max_z_int])
If I add an extra color:
colormap(parula(max_z_int-min_z_int+1))
I get different colors on z=0 and z=1 but colorbar ticks are off
so I changed
caxis([min_z_int-1 max_z_int])
but I get again same color on level z=0 and z=1...
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Color and Styling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


