I am trying to create a contourf plot with a specific color scheme. I defined the colormap as specific matrix values and defined it as such in the code.
cb=[.64 .08 .18;1 0 0;1 .41 .16;1 1 .07;1 1 1;0 1 0;0 1 1;.07 .62 1;0 0 1];
This is my contourf plot script.
figure
contourf(X_w,Z_w,w,'LevelList', [-.1 .1 .2 .4 .6],'LineColor','none')
ylim([0 4])
xlim([-4 20])
xticks([-4 -2 0 2 4 6 8 10 12 14 16 18 20])
yticks([0 .5 1 1.5 2 2.5 3 3.5 4])
pbaspect([3 1 1])
colormap(flipud(cb))
colorbar('Ytick',-.6:.2:.6)
caxis([-.6 .6])
The figure it produces is this. [1]: https://i.stack.imgur.com/b7SNv.png
Everything is correct but the white and the green should be switched. The colorbar is correct and the values are correct but the colormap does not match the colorbar. The green should be white and the white should be green.
Any suggestions?