Contour plot with NaN value ?

조회 수: 18 (최근 30일)
Akim Mahmud
Akim Mahmud 2018년 1월 7일
답변: Walter Roberson 2018년 1월 7일
Hi I have large ocean depth matrix with lots of NaN value. Please see the attached image. When I try to make a contour plot, I get a blank contour plot ? How Do I show my depth in the contour plot with the NaN value ? Thanks

답변 (1개)

Walter Roberson
Walter Roberson 2018년 1월 7일
If the NaNs represent missing data that should be assumed to vary smoothly with the surrounding data, then you would use the known data to do interpolation. Look in the file exchange for inpaint_nans .
If the NaNs represent "data at this location is invalid and should not be considered" (for example, land that is above water), then there is not a lot you can do with contouring. In that situation, perhaps you would
contour( kron(YourMatrix, ones(2,2)) )
the kron turns every location into a 2 x 2 block to give contour a chance to draw something -- but that does mess up your coordinate system.

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by