Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Hi, I have shaped an area between two graphs with one color, but I want that the shade area changes the color with rising yaxis.
조회 수: 1 (최근 30일)
이전 댓글 표시
My yaxis is temperature from 0 to 40, so in the beginning it should be blue or green and by reaching 40 it should be dark red and color changes by temperature should be very smooth. I could figure colorbar out, but could not use it really. Any help is highly appreciated.
댓글 수: 0
답변 (1개)
Star Strider
2016년 6월 1일
Try this:
x = linspace(0, 30);
t1 = 20 + 0.5*x;
t2 = 10 + 0.3*x;
c = [t1 flip(t2)];
figure(1)
patch([x flip(x)], [t1 flip(t2)], c, 'FaceColor','interp')
grid
xlabel('Distance (km)')
ylabel('Temperature (°C)')
colormap(jet(100))
<<www-mathworks-com-matlabcentral-answers-uploaded_files-53446-Hi--20I-20have-20shaped-20an-20area-20between-20two-20graphs-20with-20one-20color--20but-20I-20want-20that-20the-20shade-20area-20changes-20the-20color-20with-20rising-20yaxis-20--202016-2006-2001.png>>
댓글 수: 2
Star Strider
2016년 6월 2일
My pleasure.
That it ‘did not work’ does not give me any useful information.
It should not make a difference if they are linear or non-linear. I would have to have your data and your code to determine what the problem is.
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!