|
37 | 37 |
|
38 | 38 | if isPolar
|
39 | 39 | data.type = "scatterpolar";
|
40 |
| - updateDefaultPolaraxes(obj, plotIndex) |
41 | 40 | data.subplot = sprintf("polar%d", xSource+1);
|
| 41 | + obj.layout.(data.subplot) = updateDefaultPolarAxes(obj, plotIndex); |
42 | 42 | elseif ~isPlot3D
|
43 | 43 | data.type = "scatter";
|
44 | 44 | data.xaxis = "x" + xSource;
|
@@ -213,87 +213,77 @@ function updateScene(obj, dataIndex)
|
213 | 213 | obj.layout.("scene" + xsource) = scene;
|
214 | 214 | end
|
215 | 215 |
|
216 |
| -function updateDefaultPolaraxes(obj, plotIndex) |
| 216 | +function polarAxis = updateDefaultPolarAxes(obj, plotIndex) |
217 | 217 | %-INITIALIZATIONS-%
|
218 |
| - axIndex = obj.getAxisIndex(obj.State.Plot(plotIndex).AssociatedAxis); |
219 |
| - xSource = findSourceAxis(obj, axIndex); |
220 | 218 | plotData = obj.State.Plot(plotIndex).Handle;
|
221 | 219 | axisData = plotData.Parent;
|
222 | 220 |
|
223 | 221 | thetaAxis = axisData.XAxis;
|
224 | 222 | rAxis = axisData.YAxis;
|
| 223 | + thetaLabel = thetaAxis.Label; |
225 | 224 |
|
226 | 225 | %-set domain plot-%
|
227 | 226 | xo = axisData.Position(1);
|
228 | 227 | yo = axisData.Position(2);
|
229 | 228 | w = axisData.Position(3);
|
230 | 229 | h = axisData.Position(4);
|
231 | 230 |
|
232 |
| - polarAxis.domain.x = min([xo xo + w], 1); |
233 |
| - polarAxis.domain.y = min([yo yo + h], 1); |
234 |
| - |
235 | 231 | tickValues = rAxis.TickValues;
|
236 | 232 | tickValues = tickValues(find(tickValues==0) + 1 : end);
|
237 |
| - |
238 |
| - %-SET ANGULAR AXIS-% |
| 233 | + rLabel = rAxis.Label; |
239 | 234 |
|
240 | 235 | gridColor = getStringColor(255*axisData.GridColor, axisData.GridAlpha);
|
241 | 236 | gridWidth = axisData.LineWidth;
|
242 | 237 |
|
243 |
| - polarAxis.angularaxis.ticklen = 0; |
244 |
| - polarAxis.angularaxis.autorange = true; |
245 |
| - polarAxis.angularaxis.linecolor = gridColor; |
246 |
| - polarAxis.angularaxis.gridwidth = gridWidth; |
247 |
| - polarAxis.angularaxis.gridcolor = gridColor; |
248 |
| - polarAxis.angularaxis.rotation = -axisData.View(1); |
249 |
| - |
250 |
| - %-axis tick-% |
251 |
| - polarAxis.angularaxis.showticklabels = true; |
252 |
| - polarAxis.angularaxis.nticks = 16; |
253 |
| - polarAxis.angularaxis.tickfont.size = thetaAxis.FontSize; |
254 |
| - polarAxis.angularaxis.tickfont.color = getStringColor(... |
255 |
| - round(255*thetaAxis.Color)); |
256 |
| - polarAxis.angularaxis.tickfont.family = matlab2plotlyfont(... |
257 |
| - thetaAxis.FontName); |
258 |
| - |
259 |
| - %-axis label-% |
260 |
| - thetaLabel = thetaAxis.Label; |
261 |
| - |
262 |
| - polarAxis.angularaxis.title.text = thetaLabel.String; |
263 |
| - polarAxis.radialaxis.title.font.size = thetaLabel.FontSize; |
264 |
| - polarAxis.radialaxis.title.font.color = getStringColor(... |
265 |
| - round(255*thetaLabel.Color)); |
266 |
| - polarAxis.radialaxis.title.font.family = matlab2plotlyfont(... |
267 |
| - thetaLabel.FontName); |
268 |
| - |
269 |
| - %-SET RADIAL AXIS-% |
270 |
| - |
271 |
| - polarAxis.radialaxis.ticklen = 0; |
272 |
| - polarAxis.radialaxis.range = [0, tickValues(end)]; |
273 |
| - polarAxis.radialaxis.showline = false; |
274 |
| - |
275 |
| - polarAxis.radialaxis.angle = 80; |
276 |
| - polarAxis.radialaxis.tickangle = 80; |
277 |
| - |
278 |
| - polarAxis.radialaxis.gridwidth = gridWidth; |
279 |
| - polarAxis.radialaxis.gridcolor = gridColor; |
280 |
| - |
281 |
| - %-axis tick-% |
282 |
| - polarAxis.radialaxis.showticklabels = true; |
283 |
| - polarAxis.radialaxis.tickvals = tickValues; |
284 |
| - polarAxis.radialaxis.tickfont.size = rAxis.FontSize; |
285 |
| - polarAxis.radialaxis.tickfont.color = getStringColor(round(... |
286 |
| - 255*rAxis.Color)); |
287 |
| - polarAxis.radialaxis.tickfont.family = matlab2plotlyfont(... |
288 |
| - rAxis.FontName); |
289 |
| - |
290 |
| - rLabel = rAxis.Label; |
291 |
| - polarAxis.radialaxis.title.text = rLabel.String; |
292 |
| - polarAxis.radialaxis.title.font.size = rLabel.FontSize; |
293 |
| - polarAxis.radialaxis.title.font.color = getStringColor(round(... |
294 |
| - 255*rLabel.Color)); |
295 |
| - polarAxis.radialaxis.title.font.family = matlab2plotlyfont(... |
296 |
| - rLabel.FontName); |
297 |
| - |
298 |
| - obj.layout.(sprintf('polar%d', xSource+1)) = polarAxis; |
| 238 | + polarAxis.domain = struct( ... |
| 239 | + "x", min([xo xo + w], 1), ... |
| 240 | + "y", min([yo yo + h], 1) ... |
| 241 | + ); |
| 242 | + polarAxis.angularaxis = struct(... |
| 243 | + "ticklen", 0, ... |
| 244 | + "autorange", true, ... |
| 245 | + "linecolor", gridColor, ... |
| 246 | + "gridwidth", gridWidth, ... |
| 247 | + "gridcolor", gridColor, ... |
| 248 | + "rotation", -axisData.View(1), ... |
| 249 | + "showticklabels", true, ... |
| 250 | + "nticks", 16, ... |
| 251 | + "tickfont", struct( ... |
| 252 | + "size", thetaAxis.FontSize, ... |
| 253 | + "color", getStringColor(round(255*thetaAxis.Color)), ... |
| 254 | + "family", matlab2plotlyfont(thetaAxis.FontName) ... |
| 255 | + ), ... |
| 256 | + "title", struct( ... |
| 257 | + "text", thetaLabel.String, ... |
| 258 | + "font", struct( ... |
| 259 | + "size", thetaLabel.FontSize, ... |
| 260 | + "color", getStringColor(round(255*thetaLabel.Color)), ... |
| 261 | + "family", matlab2plotlyfont(thetaLabel.FontName) ... |
| 262 | + ) ... |
| 263 | + ) ... |
| 264 | + ); |
| 265 | + polarAxis.radialaxis = struct( ... |
| 266 | + "ticklen", 0, ... |
| 267 | + "range", [0, tickValues(end)], ... |
| 268 | + "showline", false, ... |
| 269 | + "angle", 80, ... |
| 270 | + "tickangle", 80, ... |
| 271 | + "gridwidth", gridWidth, ... |
| 272 | + "gridcolor", gridColor, ... |
| 273 | + "showticklabels", true, ... |
| 274 | + "tickvals", tickValues, ... |
| 275 | + "tickfont", struct( ... |
| 276 | + "size", rAxis.FontSize, ... |
| 277 | + "color", getStringColor(round(255*rAxis.Color)), ... |
| 278 | + "family", matlab2plotlyfont(rAxis.FontName) ... |
| 279 | + ), ... |
| 280 | + "title", struct( ... |
| 281 | + "text", rLabel.String, ... |
| 282 | + "font", struct( ... |
| 283 | + "size", rLabel.FontSize, ... |
| 284 | + "color", getStringColor(round(255*rLabel.Color)), ... |
| 285 | + "family", matlab2plotlyfont(rLabel.FontName) ... |
| 286 | + ) ... |
| 287 | + ) ... |
| 288 | + ); |
299 | 289 | end
|
0 commit comments