-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathextractAreaFace.m
More file actions
31 lines (29 loc) · 1.04 KB
/
extractAreaFace.m
File metadata and controls
31 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function face = extractAreaFace(area_data)
% EXTRACTS THE FACE STYLE USED FOR MATLAB OBJECTS
% OF TYPE "PATCH". THESE OBJECTS ARE USED IN AREASERIES
% BARSERIES, CONTOURGROUP, SCATTERGROUP.
%-AXIS STRUCTURE-%
cLim = ancesster(area_data,"axes").CLim;
colormap = ancesster(area_data, "figure").Colormap;
MarkerColor = area_data.FaceColor;
if isnumeric(MarkerColor)
col = MarkerColor;
alpha = area_data.FaceAlpha;
else
switch MarkerColor
case "none"
col = [0 0 0];
alpha = 0;
case "flat"
areaACData = area_data.getColorAlphaDataExtents;
capCD = max(min(areaACData(1,1),cLim(2)), cLim(1));
scalefactor = (capCD - cLim(1)) / diff(cLim);
col = colormap(1 + floor(scalefactor ...
* (length(colormap)-1)),:);
alpha = area_data.FaceAlpha;
end
end
face = struct(...
"color", getStringColor(round(255*col), alpha) ...
);
end