【发布时间】:2021-05-28 19:57:05
【问题描述】:
如何在 MatLab 的等值线图中更改多边形边界的颜色? (同时保持多边形内的颜色)。下面是可重现的代码。
MapLatLimit = [41 48];
MapLonLimit = [-74 -66];
NEstates = shaperead('usastatelo', 'UseGeoCoords', true, 'BoundingBox', [MapLonLimit' MapLatLimit']);
datawithNaN = [30 20 30 NaN 40 50 NaN NaN];
% Here replace NaNs with a number (treat as category):
datawithNaN(isnan(datawithNaN)) = 0;
datawithNaN = num2cell(datawithNaN);
% Here I create a color map, using white for NaN (category = 0);
mycolormap = [ 1 1 1;...
.4 .1 .9;...
.3 .2 .8;...
.2 .3 .7;...
.1 .4 .6];
[NEstates.datawithNaN] = deal(datawithNaN{:});
densityColors = makesymbolspec('Polygon', {'datawithNaN', [0 50], 'FaceColor', mycolormap});
mapshow(NEstates, 'DisplayType', 'polygon', 'SymbolSpec', densityColors)
【问题讨论】:
标签: matlab colors maps polygon matlab-figure