How to make a colormap inside an area created from points
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have excel file with 3 columns: Distance, Depth and Temperature (Please see the attached file). The question is how to make a colormap only in the area (from the surface to the river bed). See the picture below, this is what I want to create

Here is my code. My problem: the colormap is outside the depth, even I used the boundary function. Please see the picture below
data=xlsread('Day1_1704.xlsx');
x=data(:,1); %first colum in excel file, as distance
y=data(:,2);%second colum in excel file, as depth
c=data(:,3); %c is the concentration of Temperature, third column
%[X,Y] = meshgrid(x,y);
%f = scatteredInterpolant(x,y,c);
%Z = f(X,Y);
%mesh(X,Y,Z) %interpolated
subplot(2,1,1)
scatter(x,y,30,c,'filled')
colorbar
%xlim([0 18])
%ylim([-20 0])
axis tight; hold on
shading interp
ylabel('Depth (m)');
title('Temperature distribution');
view(2)
colorbar
%caxis([30 32]) %If the scale is too large, values not shown well, change scale
subplot(2,1,2)
[xg,yg] = meshgrid(min(x):0.1:max(x),min(y):0.1:max(y)); %make a grid to contain x,y
f = scatteredInterpolant(x,y,c); %assign c values to x y
vg = f(xg,yg);% assign c values to finer pixel xg yg
b=boundary(x,y,1); %create the boundary of depth in each cross section
inmask = inpolygon(xg(:),yg(:), x(b),y(b));%define which pixel exist in the polygon
vg(~inmask) = nan; %NAN values for the pixel not in the polygon
h = pcolor(xg,yg,vg); %ploting in 2D of vg by color
h.EdgeColor = 'none'; %to get rid off the edge line
colorbar
xlabel('Distance (km)');
ylabel('Depth (m)');

The upper graph is the dots from raw data, the last dot in each distance is the river bed. The second graph is the colormap that I created. Could you please help me to create the colormap only from the surface to the riverbed
10 件のコメント
Anom Sulardi
2019 年 11 月 27 日
hi Jonas,
I have make the new question ones, would you please to stop by then? Thank you
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Orange についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

