필터 지우기
필터 지우기

How to change the color code in contourf

조회 수: 4 (최근 30일)
Karthik KJ
Karthik KJ 2012년 6월 28일
Hi,
I got an old script and i am modifying it. Below is my script
for i=1:2
h= figure;contourf(X',Y',damp_matrix(:,:,i),1000,'EdgeColor','none');
colorbar
xlabel('Wind direction [deg]');
ylabel('Azimuth position [deg]');
end
Here Positive values are shown by red and negative values are shown by blue. I need the reverse of this, positive values should show blue contour and negative should show red contour.
Please help

채택된 답변

Matteo
Matteo 2012년 6월 28일
At first, you can choose a colormap with the command 'colormap', the default one is 'jet' but you can also use something else like 'hot', e.g. colormap(hot). In your case you need to invert the colormap using 'flipud', you can use the following command: colormap(flipud(jet))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by