forked from plotly/plotly_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextractPatchLine.m
More file actions
79 lines (53 loc) · 2.33 KB
/
extractPatchLine.m
File metadata and controls
79 lines (53 loc) · 2.33 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function line = extractPatchLine(patch_data)
% EXTRACTS THE LINE STYLE USED FOR MATLAB OBJECTS
% OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
% STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
%-------------------------------------------------------------------------%
%-AXIS STRUCTURE-%
axis_data = get(ancestor(patch_data.Parent,'axes'));
%-FIGURE STRUCTURE-%
figure_data = get(ancestor(patch_data.Parent,'figure'));
%-INITIALIZE OUTPUT-%
line = struct();
%-------------------------------------------------------------------------%
%-PATCH LINE COLOR-%
colormap = figure_data.Colormap;
if(~strcmp(patch_data.LineStyle,'none'))
if isnumeric(patch_data.EdgeColor)
col = 255*patch_data.EdgeColor;
line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
else
switch patch_data.EdgeColor
case 'none'
line.color = 'rgba(0,0,0,0,)';
case 'flat'
switch patch_data.CDataMapping
case 'scaled'
capCD = max(min(patch_data.FaceVertexCData(1,1),axis_data.CLim(2)),axis_data.CLim(1));
scalefactor = (capCD -axis_data.CLim(1))/diff(axis_data.CLim);
col = 255*(colormap(1+floor(scalefactor*(length(colormap)-1)),:));
case 'direct'
col = 255*(colormap(patch_data.FaceVertexCData(1,1),:));
end
line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
end
end
%---------------------------------------------------------------------%
%-PATCH LINE WIDTH (STYLE)-%
line.width = patch_data.LineWidth;
%---------------------------------------------------------------------%
%-PATCH LINE DASH (STYLE)-%
switch patch_data.LineStyle
case '-'
LineStyle = 'solid';
case '--'
LineStyle = 'dash';
case ':'
LineStyle = 'dot';
case '-.'
LineStyle = 'dashdot';
end
line.dash = LineStyle;
%---------------------------------------------------------------------%
end
end