Adding a filled polygon to a pcolor as a mask

조회 수: 2 (최근 30일)
Gordon Jones
Gordon Jones 2011년 6월 23일
I've got a spatial dataset that intrudes into the seabed because of the way it's been produced. However, I'm only interested in the water column data for display purposes. I'm trying to create a plot that has a filled polygon creating the sea bed.
figure
h1 = pcolor(range,depth,datacomp);
hold on
fill(brange,bathy,'k');
hold on
colormap(jet(128))
hcb = colorbar;
shading interp
This produces my pcolor chart without any problems, however I don't get my polygon produced by the fill command. brange and bathy are both arrays of the same dimensions and are the same length as my main dataset. What am I doing wrong this time?

답변 (1개)

Walter Roberson
Walter Roberson 2011년 6월 23일
They may be the consistent sizes, but do they have consistent meanings?
pcolor(range,depth,datacomp) uses range as x coordinates, depth as y coordinates, and creates a grid from datacomp over those coordinates. Are the values in brange the same scale and origin point as the coordinates for "range"? How about bathy vs depth ?
  댓글 수: 1
Gordon Jones
Gordon Jones 2011년 6월 25일
brange is simply range, but with an extra row of data.
range is a 1x600 array, depth is a 1x100 array, datacomp is 100x600.
brange is 2x600, bathy is 2x600. Should this work?
They are from the same origin though.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by