Filled contour plot colormap
Show older comments
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...
Accepted Answer
More Answers (0)
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

