|
1 |
| -function obj = updateHistogram(obj,histIndex) |
| 1 | +function data = updateHistogram(obj,histIndex) |
2 | 2 | % x:...[DONE]
|
3 | 3 | % y:...[DONE]
|
4 | 4 | % histnorm:...[DONE]
|
|
54 | 54 | %-CHECK FOR MULTIPLE AXES-%
|
55 | 55 | [xsource, ysource] = findSourceAxis(obj,axIndex);
|
56 | 56 |
|
57 |
| - obj.data{histIndex}.xaxis = "x" + xsource; |
58 |
| - obj.data{histIndex}.yaxis = "y" + ysource; |
59 |
| - obj.data{histIndex}.type = "bar"; |
| 57 | + data.xaxis = "x" + xsource; |
| 58 | + data.yaxis = "y" + ysource; |
| 59 | + data.type = "bar"; |
60 | 60 |
|
61 | 61 | if isprop(hist_data, "Orientation")
|
62 | 62 | %-Matlab 2014+ histogram() function-%
|
|
69 | 69 | switch orientation
|
70 | 70 | case {"vertical", "horizontal"}
|
71 | 71 | %-hist y data-%
|
72 |
| - obj.data{histIndex}.x = hist_data.BinEdges(1:end-1) ... |
| 72 | + data.x = hist_data.BinEdges(1:end-1) ... |
73 | 73 | + 0.5*diff(hist_data.BinEdges);
|
74 |
| - obj.data{histIndex}.width = diff(hist_data.BinEdges); |
75 |
| - obj.data{histIndex}.y = double(hist_data.Values); |
| 74 | + data.width = diff(hist_data.BinEdges); |
| 75 | + data.y = double(hist_data.Values); |
76 | 76 | case "v"
|
77 | 77 | %-hist x data-%
|
78 | 78 | xdata = mean(hist_data.XData(2:3,:));
|
|
81 | 81 | xlength = 0;
|
82 | 82 | for d = 1:length(xdata)
|
83 | 83 | xnew = repmat(xdata(d),1,hist_data.YData(2,d));
|
84 |
| - obj.data{histIndex}.x(xlength+1:xlength+length(xnew)) = xnew; |
85 |
| - xlength = length(obj.data{histIndex}.x); |
| 84 | + data.x(xlength+1:xlength+length(xnew)) = xnew; |
| 85 | + xlength = length(data.x); |
86 | 86 | end
|
87 | 87 |
|
88 | 88 | %-hist autobinx-%
|
89 |
| - obj.data{histIndex}.autobinx = false; |
| 89 | + data.autobinx = false; |
90 | 90 |
|
91 | 91 | %-hist xbins-%
|
92 | 92 | xbins.start = hist_data.XData(2,1);
|
93 | 93 | xbins.end = hist_data.XData(3,end);
|
94 | 94 | xbins.size = diff(hist_data.XData(2:3,1));
|
95 |
| - obj.data{histIndex}.xbins = xbins; |
| 95 | + data.xbins = xbins; |
96 | 96 |
|
97 | 97 | %-layout bargap-%
|
98 | 98 | obj.layout.bargap = ...
|
|
105 | 105 | ylength = 0;
|
106 | 106 | for d = 1:length(ydata)
|
107 | 107 | ynew = repmat(ydata(d),1,hist_data.XData(2,d));
|
108 |
| - obj.data{histIndex}.y(ylength+1:ylength+length(ynew)) = ynew; |
109 |
| - ylength = length(obj.data{histIndex}.y); |
| 108 | + data.y(ylength+1:ylength+length(ynew)) = ynew; |
| 109 | + ylength = length(data.y); |
110 | 110 | end
|
111 | 111 |
|
112 | 112 | %-hist autobiny-%
|
113 |
| - obj.data{histIndex}.autobiny = false; |
| 113 | + data.autobiny = false; |
114 | 114 |
|
115 | 115 | %-hist ybins-%
|
116 | 116 | ybins.start = hist_data.YData(2,1);
|
117 | 117 | ybins.end = hist_data.YData(3,end);
|
118 | 118 | ybins.size = diff(hist_data.YData(2:3,1));
|
119 |
| - obj.data{histIndex}.ybins = ybins; |
| 119 | + data.ybins = ybins; |
120 | 120 |
|
121 | 121 | %-layout bargap-%
|
122 | 122 | obj.layout.bargap = ...
|
123 | 123 | (hist_data.XData(3,1) - hist_data.XData(2,2)) ...
|
124 | 124 | / (hist_data.XData(3,1) - hist_data.XData(2,1));
|
125 | 125 | end
|
126 | 126 |
|
127 |
| - obj.data{histIndex}.name = hist_data.DisplayName; |
| 127 | + data.name = hist_data.DisplayName; |
128 | 128 | obj.layout.barmode = "overlay";
|
129 |
| - obj.data{histIndex}.marker.line.width = hist_data.LineWidth; |
| 129 | + data.marker.line.width = hist_data.LineWidth; |
130 | 130 |
|
131 | 131 | %-hist opacity-%
|
132 | 132 | if ~ischar(hist_data.FaceAlpha)
|
133 |
| - obj.data{histIndex}.opacity = hist_data.FaceAlpha * 1.25; |
| 133 | + data.opacity = hist_data.FaceAlpha * 1.25; |
134 | 134 | end
|
135 | 135 |
|
136 |
| - obj.data{histIndex}.marker = extractPatchFace(hist_data); |
137 |
| - obj.data{histIndex}.visible = strcmp(hist_data.Visible,"on"); |
| 136 | + data.marker = extractPatchFace(hist_data); |
| 137 | + data.visible = hist_data.Visible == "on"; |
138 | 138 |
|
139 |
| - %-hist showlegend-% |
140 |
| - leg = hist_data.Annotation; |
141 |
| - legInfo = leg.LegendInformation; |
142 |
| - |
143 |
| - switch legInfo.IconDisplayStyle |
| 139 | + switch hist_data.Annotation.LegendInformation.IconDisplayStyle |
144 | 140 | case "on"
|
145 |
| - showleg = true; |
| 141 | + data.showlegend = true; |
146 | 142 | case "off"
|
147 |
| - showleg = false; |
| 143 | + data.showlegend = false; |
148 | 144 | end
|
149 |
| - obj.data{histIndex}.showlegend = showleg; |
150 | 145 | end
|
0 commit comments