2 color scheme on contour plot
4 次查看(过去 30 天)
显示 更早的评论
I am wanting to contour an xy plane with z values. The particular data that I am analyzing is conduction velocity. I have been able to set up the contour plot the way I am wanting but am having trouble with modifying the colors that it is displaying. I am wanting to color the map in Green for areas that have a CV above a particular value and Red in areas when the CV falls below that value.
0 个评论
回答(1 个)
Star Strider
2016-4-18
编辑:Star Strider
2016-4-18
See if this does what you want:
[X,Y] = meshgrid(-10:10);
Z = X.^2 + 0.1*Y.^3; % Create Data
figure(1)
contourf(X, Y, Z, [min(Z(:)); 10]) % Use The ‘10’ Contour As The Cutoff
colormap([1,0,0; 0,1,0]) % Define Colours In ‘colormap’
figure(2)
surf(X, Y, Z)
grid on
colormap([1,0,0; 0,1,0])
The surf plot is there simply to demonstrate that the contourf call does what you want. The surf plot does not use a specific cutoff. See the documentation for contourf for a full description of how this particular call to it works.
4 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!