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!