|
| 1 | +function updateScatterPolar(obj,scatterIndex) |
| 2 | + |
| 3 | +%check: http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior |
| 4 | + |
| 5 | +%----SCATTER FIELDS----% |
| 6 | + |
| 7 | +% x - [DONE] |
| 8 | +% y - [DONE] |
| 9 | +% r - [HANDLED BY SCATTER] |
| 10 | +% t - [HANDLED BY SCATTER] |
| 11 | +% mode - [DONE] |
| 12 | +% name - [DONE] |
| 13 | +% text - [NOT SUPPORTED IN MATLAB] |
| 14 | +% error_y - [HANDLED BY ERRORBAR] |
| 15 | +% error_x - [NOT SUPPORTED IN MATLAB] |
| 16 | +% textfont - [NOT SUPPORTED IN MATLAB] |
| 17 | +% textposition - [NOT SUPPORTED IN MATLAB] |
| 18 | +% xaxis [DONE] |
| 19 | +% yaxis [DONE] |
| 20 | +% showlegend [DONE] |
| 21 | +% stream - [HANDLED BY PLOTLYSTREAM] |
| 22 | +% visible [DONE] |
| 23 | +% type [DONE] |
| 24 | +% opacity ---[TODO] |
| 25 | + |
| 26 | +% MARKER |
| 27 | +% marler.color - [DONE] |
| 28 | +% marker.size - [DONE] |
| 29 | +% marker.opacity - [NOT SUPPORTED IN MATLAB] |
| 30 | +% marker.colorscale - [NOT SUPPORTED IN MATLAB] |
| 31 | +% marker.sizemode - [DONE] |
| 32 | +% marker.sizeref - [DONE] |
| 33 | +% marker.maxdisplayed - [NOT SUPPORTED IN MATLAB] |
| 34 | + |
| 35 | +% MARKER LINE |
| 36 | +% marker.line.color - [DONE] |
| 37 | +% marker.line.width - [DONE] |
| 38 | +% marker.line.dash - [NOT SUPPORTED IN MATLAB] |
| 39 | +% marker.line.opacity - [DONE] |
| 40 | +% marker.line.smoothing - [NOT SUPPORTED IN MATLAB] |
| 41 | +% marker.line.shape - [NOT SUPPORTED IN MATLAB] |
| 42 | + |
| 43 | +% LINE |
| 44 | +% line.color - [NA] |
| 45 | +% line.width - [NA] |
| 46 | +% line.dash - [NA] |
| 47 | +% line.opacity [NA] |
| 48 | +% line.smoothing - [NOT SUPPORTED IN MATLAB] |
| 49 | +% line.shape - [NOT SUPPORTED IN MATLAB] |
| 50 | +% connectgaps - [NOT SUPPORTED IN MATLAB] |
| 51 | +% fill - [HANDLED BY AREA] |
| 52 | +% fillcolor - [HANDLED BY AREA] |
| 53 | + |
| 54 | +%-AXIS INDEX-% |
| 55 | +axIndex = obj.getAxisIndex(obj.State.Plot(scatterIndex).AssociatedAxis); |
| 56 | + |
| 57 | +%-SCATTER DATA STRUCTURE- % |
| 58 | +scatter_data = get(obj.State.Plot(scatterIndex).Handle); |
| 59 | + |
| 60 | +%-------------------------------------------------------------------------% |
| 61 | + |
| 62 | +%-scatterpolar type-% |
| 63 | +obj.data{scatterIndex}.type = 'scatterpolar'; |
| 64 | + |
| 65 | +%-------------------------------------------------------------------------% |
| 66 | + |
| 67 | +%-scatter mode-% |
| 68 | +obj.data{scatterIndex}.mode = 'markers'; |
| 69 | + |
| 70 | +%-------------------------------------------------------------------------% |
| 71 | + |
| 72 | +%-scatter visible-% |
| 73 | +obj.data{scatterIndex}.visible = strcmp(scatter_data.Visible,'on'); |
| 74 | + |
| 75 | +%-------------------------------------------------------------------------% |
| 76 | + |
| 77 | +%-scatter name-% |
| 78 | +obj.data{scatterIndex}.name = scatter_data.DisplayName; |
| 79 | + |
| 80 | +%-------------------------------------------------------------------------% |
| 81 | + |
| 82 | +%-scatter patch data-% |
| 83 | +for m = 1:length(scatter_data) |
| 84 | + |
| 85 | + %reverse counter |
| 86 | + n = length(scatter_data) - m + 1; |
| 87 | + |
| 88 | + %---------------------------------------------------------------------% |
| 89 | + |
| 90 | + %-scatter r-% |
| 91 | + if length(scatter_data) > 1 |
| 92 | + obj.data{scatterIndex}.r(m) = scatter_data(n).RData; |
| 93 | + else |
| 94 | + obj.data{scatterIndex}.r = scatter_data.RData; |
| 95 | + end |
| 96 | + |
| 97 | + %---------------------------------------------------------------------% |
| 98 | + |
| 99 | + %-scatter theta-% |
| 100 | + if length(scatter_data) > 1 |
| 101 | + obj.data{scatterIndex}.theta(m) = rad2deg(scatter_data(n).ThetaData); |
| 102 | + else |
| 103 | + obj.data{scatterIndex}.theta = rad2deg(scatter_data.ThetaData); |
| 104 | + end |
| 105 | + |
| 106 | + |
| 107 | + %---------------------------------------------------------------------% |
| 108 | + |
| 109 | + %-scatter showlegend-% |
| 110 | + leg = get(scatter_data.Annotation); |
| 111 | + legInfo = get(leg.LegendInformation); |
| 112 | + |
| 113 | + switch legInfo.IconDisplayStyle |
| 114 | + case 'on' |
| 115 | + showleg = true; |
| 116 | + case 'off' |
| 117 | + showleg = false; |
| 118 | + end |
| 119 | + |
| 120 | + if isfield(scatter_data,'ZData') |
| 121 | + if isempty(scatter_data.ZData) |
| 122 | + obj.data{scatterIndex}.showlegend = showleg; |
| 123 | + end |
| 124 | + end |
| 125 | + |
| 126 | + %---------------------------------------------------------------------% |
| 127 | + |
| 128 | + %-scatter marker-% |
| 129 | + childmarker = extractScatterMarker(scatter_data(n)); |
| 130 | + |
| 131 | + %---------------------------------------------------------------------% |
| 132 | + |
| 133 | + %-line color-% |
| 134 | + if length(scatter_data) > 1 |
| 135 | + obj.data{scatterIndex}.marker.line.color{m} = childmarker.line.color{1}; |
| 136 | + else |
| 137 | + if length(childmarker.line.color) > 3 |
| 138 | + obj.data{scatterIndex}.marker.line.color = childmarker.line.color; |
| 139 | + else |
| 140 | + obj.data{scatterIndex}.marker.line.color = childmarker.line.color{1}; |
| 141 | + end |
| 142 | + end |
| 143 | + |
| 144 | + %---------------------------------------------------------------------% |
| 145 | + |
| 146 | + %-marker color-% |
| 147 | + if length(scatter_data) > 1 |
| 148 | + obj.data{scatterIndex}.marker.color{m} = childmarker.color{1}; |
| 149 | + else |
| 150 | + obj.data{scatterIndex}.marker.color = childmarker.color; |
| 151 | + end |
| 152 | + |
| 153 | + %---------------------------------------------------------------------% |
| 154 | + |
| 155 | + %-sizeref-% |
| 156 | + obj.data{scatterIndex}.marker.sizeref = childmarker.sizeref; |
| 157 | + |
| 158 | + %---------------------------------------------------------------------% |
| 159 | + |
| 160 | + %-sizemode-% |
| 161 | + obj.data{scatterIndex}.marker.sizemode = childmarker.sizemode; |
| 162 | + |
| 163 | + %---------------------------------------------------------------------% |
| 164 | + |
| 165 | + %-symbol-% |
| 166 | + if length(scatter_data) > 1 |
| 167 | + obj.data{scatterIndex}.marker.symbol{m} = childmarker.symbol; |
| 168 | + else |
| 169 | + obj.data{scatterIndex}.marker.symbol = childmarker.symbol; |
| 170 | + end |
| 171 | + |
| 172 | + %---------------------------------------------------------------------% |
| 173 | + |
| 174 | + %-size-% |
| 175 | + if length(scatter_data) > 1 |
| 176 | + obj.data{scatterIndex}.marker.size = childmarker.size; |
| 177 | + else |
| 178 | + obj.data{scatterIndex}.marker.size = childmarker.size * 0.15; |
| 179 | + end |
| 180 | + |
| 181 | + %---------------------------------------------------------------------% |
| 182 | + |
| 183 | + %-line width-% |
| 184 | + |
| 185 | + if length(scatter_data) > 1 || ischar(childmarker.line.color) |
| 186 | + obj.data{scatterIndex}.marker.line.width(m) = childmarker.line.width; |
| 187 | + else |
| 188 | + obj.data{scatterIndex}.marker.line.width = childmarker.line.width; |
| 189 | + % obj.data{scatterIndex}.marker.line.width(1:length(childmarker.line.color)) = childmarker.line.width; |
| 190 | + end |
| 191 | + |
| 192 | + %---------------------------------------------------------------------% |
| 193 | + |
| 194 | +end |
| 195 | +end |
| 196 | + |
0 commit comments