forked from plotly/plotly_matlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateFigure.m
More file actions
97 lines (70 loc) · 2.85 KB
/
updateFigure.m
File metadata and controls
97 lines (70 loc) · 2.85 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
93
94
95
%----UPDATE FIGURE DATA/LAYOUT----%
function obj = updateFigure(obj)
%--------PLOTLY LAYOUT FIELDS---------%
% title ..........[HANDLED BY updateAxis]
% titlefont ..........[HANDLED BY updateAxis]
% font ..........[HANDLED BY updateAxis]
% showlegend ..........[HANDLED BY updateAxis]
% autosize ... DONE
% width ... DONE
% height .... DONE
% xaxis ..........[HANDLED BY updateAxis]
% yaxis ..........[HANDLED BY updateAxis]
% legend ..........[HANDLED BY updateAxis]
% annotations ..........[HANDLED BY updateAnnotation]
% margin ...DONE
% paper_bgcolor ...DONE
% plot_bgcolor ..........[HANDLED BY updateAxis]
% hovermode ..........[NOT SUPPORTED IN MATLAB]
% dragmode ..........[NOT SUPPORTED IN MATLAB]
% separators ..........[NOT SUPPORTED IN MATLAB]
% barmode ..........[HANDLED BY updateBar]
% bargap ..........[HANDLED BY updateBar]
% bargroupgap ..........[HANDLED BY updateBar]
% boxmode ..........[HANDLED BY updateBox]
% radialaxis ..........[HANDLED BY updatePolar]
% angularaxis ..........[HANDLED BY updatePolar]
% direction ..........[HANDLED BY updatePolar]
% orientation ..........[HANDLED BY updatePolar]
% hidesources ..........[NOT SUPPORTED IN MATLAB]
%-STANDARDIZE UNITS-%
figunits = get(obj.State.Figure.Handle,'Units');
set(obj.State.Figure.Handle,'Units','pixels');
%-FIGURE DATA-%
figure_data = get(obj.State.Figure.Handle);
%-------------------------------------------------------------------------%
%-figure autosize-%
obj.layout.autosize = false;
%-------------------------------------------------------------------------%
%-figure margin pad-%
obj.layout.margin.pad = obj.PlotlyDefaults.MarginPad;
%-------------------------------------------------------------------------%
%-figure show legend-%
if(obj.State.Figure.NumLegends > 1)
obj.layout.showlegend = true;
else
obj.layout.showlegend = false;
end
%-------------------------------------------------------------------------%
%-margins-%
obj.layout.margin.l = 0;
obj.layout.margin.r = 0;
obj.layout.margin.b = 0;
obj.layout.margin.t = 0;
%-------------------------------------------------------------------------%
%-figure width-%
obj.layout.width = figure_data.Position(3)*obj.PlotlyDefaults.FigureIncreaseFactor;
%-------------------------------------------------------------------------%
%-figure height-%
obj.layout.height = figure_data.Position(4)*obj.PlotlyDefaults.FigureIncreaseFactor;
%-------------------------------------------------------------------------%
%-figure paper bgcolor-%
col = 255*figure_data.Color;
obj.layout.paper_bgcolor = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')'];
%-------------------------------------------------------------------------%
%-figure hovermode-%
obj.layout.hovermode = 'closest';
%-------------------------------------------------------------------------%
%-REVERT UNITS-%
set(obj.State.Figure.Handle,'Units',figunits);
end