Change color axes of interpolation

2 ビュー (過去 30 日間)
Dennis T
Dennis T 2021 年 5 月 19 日
回答済み: Zeeshaan Ali 2021 年 5 月 20 日
Hello,
I am using griddata to interpolate a surface based on the data points of two sets described here (https://www.mathworks.com/help/matlab/ref/griddata.html)
The interpolation works well, but I was wondering if it was possible to change the color used so that the two interpolated surfaces are the same color scale.
Right now the interpolation of Set A has a high of 50 and a low of 10 while the interpolation of Set B has a high of 40 and a low of 25. Both uses red as the high point and gradually goes to blue as the low point.
What I would like to do is use the same axes color scale so that Set A would still show the high/red as 50 and low/blue as 10 while Set B would show its high of 40 as a orange color while its low of 25 as a greenish color.
Is that possible?
Thanks

採用された回答

Zeeshaan Ali
Zeeshaan Ali 2021 年 5 月 20 日
Hi Dennis,
I would suggest you try out the below simple example showcasing the use of caxis which leverages the previous plot’s color scheme.
[X1,Y1] = meshgrid(-10:.5:10);
R1 = X1.^2 + Y1.^2;
Z1 = R1
[X2,Y2] = meshgrid(-5:.5:5);
R2 = X2.^4 + Y2.^4;
Z2 = R2;
ax1 = subplot(2,1,1);
ax2 = subplot(2,1,2);
m1 = mesh(ax1,Z1);
c1 = caxis(ax1);
m2 = mesh(ax2,Z2);
caxis(ax2,c1)
I hope this helps.
Zeeshaan

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by