face alpha for range of raster values
2 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I'm plotting raster data with the mapshow function and would like to set the raster values that are NaN to completely transparent, and the rest to partially transparent. The below sample code creates an example raster file with NaN values. Then it plot the data and sets the transparency of all the data, but I can't figure out how to set the transparency of just the NaN values.
Z = peaks(140);
Z(81:end,:) = [];
Z(Z < 0.5 & Z > -0.5)= nan;
R = maprasterref('RasterSize',[80 140],'ColumnsStartFrom','north','XLimWorld',[1345084 1437484],'YLimWorld',[369602 422402]);
key.GTModelTypeGeoKey = 1;
key.GTRasterTypeGeoKey = 1;
key.ProjectedCSTypeGeoKey = 32104;
geotiffwrite('testraster',Z,R,'GeoKeyDirectoryTag',key)
t = mapshow('testraster.tif','DisplayType','texture');
t.FaceAlpha = 0.5;
Thanks for your time and wisdome!
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!