hide NaNs in geoshow
조회 수: 27(최근 30일)
I am plotting some data using geoshow as below: geoshow (yy, xx, data, 'displaytype', 'texturemap'); The 'data' has a lot of NaNs in it and I do not want to show them (or display them as white) in the resulting image, neither in the colorbar (colorbar should not show the white color). The range of data is between 0 and 1.5. I tried using alphadata as below: t = geoshow (yy, xx, data, 'displaytype', 'texturemap'); set(t, 'AlphaData', ~isnan(data)); but I get the error 'value must be numeric'. I looked in the forums and there are not really clean solution to this problem. Could you please provide a nice, clean solution?
Amy Haskins 2015년 11월 10일
Try using 'DisplayType', 'surface' instead of 'texturemap'. Also try looking at the fourth example on the geoshow doc page "Create Map of Korea and Display NaNs as Transparent".
Chad Greene 2015년 11월 6일
Yeah, that set AlphaData trick works for imagesc but not for geoshow. You can try to work around it by converting the logical to numeric like this:
But I doubt it will work the way you want it to. I tend to avoid using geoshow because I'm never quite sure how it will behave. It decides which plotting function to call based on what you enter, so why not call the plotting function directly? Can you use pcolor, pcolorm or imagesc?