forked from plotly/plotly_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateSurfaceplot.m
More file actions
92 lines (59 loc) · 2.42 KB
/
updateSurfaceplot.m
File metadata and controls
92 lines (59 loc) · 2.42 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
80
81
82
83
84
85
86
87
88
89
90
91
92
function obj = updateSurfaceplot(obj, surfaceIndex)
%-AXIS INDEX-%
axIndex = obj.getAxisIndex(obj.State.Plot(surfaceIndex).AssociatedAxis);
%-CHECK FOR MULTIPLE AXES-%
[xsource, ysource] = findSourceAxis(obj,axIndex);
%-SURFACE DATA STRUCTURE- %
image_data = get(obj.State.Plot(surfaceIndex).Handle);
%-AXIS DATA-%
eval(['xaxis = obj.layout.xaxis' num2str(xsource) ';']);
eval(['yaxis = obj.layout.yaxis' num2str(ysource) ';']);
%-------------------------------------------------------------------------%
%-surface xaxis-%
obj.data{surfaceIndex}.xaxis = ['x' num2str(xsource)];
%-------------------------------------------------------------------------%
%-surface yaxis-%
obj.data{surfaceIndex}.yaxis = ['y' num2str(ysource)];
%-------------------------------------------------------------------------%
% check for 3D
if any(nonzeros(image_data.ZData))
%-surface type-%
obj.data{surfaceIndex}.type = 'surface';
%---------------------------------------------------------------------%
%-surface x-%
obj.data{surfaceIndex}.x = image_data.XData;
%---------------------------------------------------------------------%
%-surface y-%
obj.data{surfaceIndex}.y = image_data.YData;
%---------------------------------------------------------------------%
%-surface z-%
obj.data{surfaceIndex}.z = image_data.ZData;
else
%-surface type-%
obj = updateImage(obj, surfaceIndex);
%-surface x-%
obj.data{surfaceIndex}.x = image_data.XData(1,:);
%-surface y-%
obj.data{surfaceIndex}.y = image_data.YData(:,1);
end
%-------------------------------------------------------------------------%
%-surface name-%
obj.data{surfaceIndex}.name = image_data.DisplayName;
%-------------------------------------------------------------------------%
%-surface showscale-%
obj.data{surfaceIndex}.showscale = false;
%-------------------------------------------------------------------------%
%-surface visible-%
obj.data{surfaceIndex}.visible = strcmp(image_data.Visible,'on');
%-------------------------------------------------------------------------%
leg = get(image_data.Annotation);
legInfo = get(leg.LegendInformation);
switch legInfo.IconDisplayStyle
case 'on'
showleg = true;
case 'off'
showleg = false;
end
obj.data{surfaceIndex}.showlegend = showleg;
%-------------------------------------------------------------------------%
end