-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathspider_plot_class.m
2181 lines (1832 loc) · 86.3 KB
/
spider_plot_class.m
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
classdef spider_plot_class < matlab.graphics.chartcontainer.ChartContainer & ...
matlab.graphics.chartcontainer.mixin.Legend
%spider_plot_class Create a spider or radar plot with individual axes.
%
% Syntax:
% s = spider_plot_class(P)
% s = spider_plot_class(P, Name, Value, ...)
% s = spider_plot_class(parent, ___)
%
% Documentation:
% Please refer to the MathWorks File Exchange or GitHub page for the
% detailed documentation and examples.
%%% Public, SetObservable Properties %%%
properties(Access = public, SetObservable)
% Property validation and defaults
P (:, :) double
AxesLabels cell % Axes labels
LegendLabels cell % Legend labels
LegendHandle % Legend handle
AxesInterval (1, 1) double {mustBeInteger, mustBePositive} = 3 % Number of axes grid lines
AxesPrecision (:, :) double {mustBeInteger, mustBeNonnegative} = 1 % Tick precision
AxesDisplay char {mustBeMember(AxesDisplay, {'all', 'none', 'one', 'data', 'data-percent'})} = 'all' % Number of tick label groups shown on axes
AxesLimits double = [] % Axes limits
FillOption {mustBeMember(FillOption, {'on', 'off', 'interp'})} = 'off' % Whether to shade data
FillTransparency double {mustBeGreaterThanOrEqual(FillTransparency, 0), mustBeLessThanOrEqual(FillTransparency, 1)} = 0.2 % Shading alpha
Color = get(groot,'defaultAxesColorOrder') % Color order
LineStyle = '-' % Data line style
LineWidth (:, :) double {mustBePositive} = 2 % Data line width
LineTransparency double {mustBeGreaterThanOrEqual(LineTransparency, 0), mustBeLessThanOrEqual(LineTransparency, 1)} = 1 % Shading alpha
Marker = 'o' % Data marker
MarkerSize (:, :) double {mustBePositive} = 36 % Data marker size
MarkerTransparency double {mustBeGreaterThanOrEqual(MarkerTransparency, 0), mustBeLessThanOrEqual(MarkerTransparency, 1)} = 1 % Shading alpha
AxesFont char ='Helvetica' % Axes tick font type
AxesFontColor = [0, 0, 0] % Axes font color
LabelFont char = 'Helvetica' % Label font type
AxesFontSize (1, 1) double {mustBePositive} = 10 % Axes tick font size
LabelFontSize (1, 1) double {mustBePositive} = 10 % Label font size
Direction char {mustBeMember(Direction, {'counterclockwise', 'clockwise'})} = 'clockwise'
AxesDirection = 'normal'
AxesLabelsOffset (1, 1) double {mustBeNonnegative} = 0.2 % Offset position of axes labels
AxesDataOffset (1, 1) double {mustBeNonnegative} = 0.1 % Offset position of axes data labels
AxesScaling = 'linear' % Scaling of axes
AxesColor = [0.6, 0.6, 0.6] % Axes color
AxesLabelsEdge = 'k' % Axes label color
AxesOffset (1, 1) double {mustBeNonnegative, mustBeInteger} = 1 % Axes offset
AxesZoom double {mustBeGreaterThanOrEqual(AxesZoom, 0), mustBeLessThanOrEqual(AxesZoom, 1)} = 0.7 % Axes scale
AxesHorzAlign char {mustBeMember(AxesHorzAlign, {'center', 'left', 'right', 'quadrant'})} = 'center' % Horizontal alignment of axes labels
AxesVertAlign char {mustBeMember(AxesVertAlign, {'middle', 'top', 'cap', 'bottom', 'baseline', 'quadrant'})} = 'middle' % Vertical alignment of axes labels
TiledLayoutHandle % Tiled layout handle
TiledLegendHandle % Tiled legend handle
PlotVisible {mustBeMember(PlotVisible, {'off', 'on'})} = 'on'
AxesTickLabels {mustBeText} = 'data'
AxesInterpreter {mustBeText} = 'tex'
AxesTickInterpreter {mustBeText} = 'tex'
BackgroundColor = [1, 1, 1]
MinorGrid {mustBeMember(MinorGrid, {'off', 'on'})} = 'off'
MinorGridInterval (1, 1) double {mustBePositive, mustBeInteger} = 2
AxesZero {mustBeMember(AxesZero, {'off', 'on'})} = 'off'
AxesZeroColor = [0, 0, 0];
AxesZeroWidth (1, 1) double {mustBePositive} = 2
AxesRadial {mustBeMember(AxesRadial, {'off', 'on'})} = 'on'
AxesWeb {mustBeMember(AxesWeb, {'off', 'on'})} = 'on'
AxesShaded {mustBeMember(AxesShaded, {'off', 'on'})} = 'off'
AxesShadedLimits cell = {}
AxesShadedColor = 'g'
AxesShadedTransparency double {mustBeGreaterThanOrEqual(AxesShadedTransparency, 0), mustBeLessThanOrEqual(AxesShadedTransparency, 1)} = 0.2 % Shading alpha
AxesLabelsRotate {mustBeMember(AxesLabelsRotate, {'off', 'on'})} = 'off'
ErrorBars {mustBeMember(ErrorBars, {'off', 'on'})} = 'off'
AxesWebType {mustBeMember(AxesWebType, {'web', 'circular'})} = 'web'
AxesTickFormat {mustBeText} = 'default'
UserData struct
FillCData = []
ErrorPositive = []
ErrorNegative = []
AxesStart = pi/2
AxesRadialLineStyle = '-';
AxesRadialLineWidth = 1.5;
AxesWebLineStyle = '-';
AxesWebLineWidth = 1;
end
%%% Private, NonCopyable, Transient Properties %%%
properties(Access = private, NonCopyable, Transient)
% Data line object
DataLines = gobjects(0);
ScatterPoints = gobjects(0);
NanPoints = gobjects(0);
ErrorBarPoints = gobjects(0);
ErrorBarLines = gobjects(0);
% Background web object
ThetaAxesLines = gobjects(0);
RhoAxesLines = gobjects(0);
RhoMinorLines = gobjects(0);
% Fill shade object
FillPatches = gobjects(0);
AxesPatches = gobjects(0);
% Web axes tick values
AxesValues = [];
% Axes label object
AxesTextLabels = gobjects(0);
AxesTickText = gobjects(0);
AxesDataLabels = gobjects(0);
% Initialize toggle state
InitializeToggle = true;
% NextTile iterator
NextTileIter (1, 1) double {mustBeInteger, mustBePositive} = 1
end
%%% Protected, Dependent, Hidden Properties %%%
properties(Access = protected, Dependent, Hidden)
NumDataGroups
NumDataPoints
end
methods
%%% Constructor Methods %%%
function obj = spider_plot_class(parentOrP, varargin)
% Validate number of input arguments
narginchk(1, inf);
% Check if first argument is a graphic object or data
if isa(parentOrP, 'matlab.graphics.Graphics')
% spider_plot_class(parent, P, Name, Value, ...)
args = [{parentOrP, 'P'}, varargin];
else
% spider_plot_class(P, Name, Value, ...)
args = [{'P', parentOrP}, varargin];
end
% Call superclass constructor method
[email protected](args{:});
end
%%% Set Methods %%%
function set.P(obj, value)
% Set property
obj.P = value;
% Toggle re-initialize to true if P was changed
obj.InitializeToggle = true; %#ok<*MCSUP>
end
function set.AxesLabels(obj, value)
% Validate axes labels
validateAxesLabels(value, obj.P);
% Set property
obj.AxesLabels = value;
% Toggle re-initialize to true if AxesLabels was changed
obj.InitializeToggle = true;
end
function set.LegendLabels(obj, value)
% Validate legend labels
validateLegendLabels(value, obj.P);
% Set property
obj.LegendLabels = value;
% Set legend handle
obj.LegendHandle = getLegend(obj);
obj.LegendHandle.Color = obj.BackgroundColor;
% Toggle re-initialize to true if LegendLabels was changed
obj.InitializeToggle = true;
end
function set.AxesInterval(obj, value)
% Set property
obj.AxesInterval = value;
% Toggle re-initialize to true if AxesInterval was changed
obj.InitializeToggle = true;
end
function set.AxesPrecision(obj, value)
% Set property
obj.AxesPrecision = value;
% Toggle re-initialize to true if AxesPrecision was changed
obj.InitializeToggle = true;
end
function set.AxesDisplay(obj, value)
% Set property
obj.AxesDisplay = value;
% Toggle re-initialize to true if AxesDisplay was changed
obj.InitializeToggle = true;
end
function set.AxesLimits(obj, value)
% Set property
obj.AxesLimits = value;
% Toggle re-initialize to true if AxesLimits was changed
obj.InitializeToggle = true;
end
function set.FillOption(obj, value)
% Set property
obj.FillOption = value;
% Toggle re-initialize to true if FillOption was changed
obj.InitializeToggle = true;
end
function set.FillTransparency(obj, value)
% Set property
obj.FillTransparency = value;
% Toggle re-initialize to true if FillTransparency was changed
obj.InitializeToggle = true;
end
function set.Color(obj, value)
% Set property
obj.Color = value;
% Toggle re-initialize to true if Color was changed
obj.InitializeToggle = true;
end
function set.LineStyle(obj, value)
% Set property
obj.LineStyle = value;
% Toggle re-initialize to true if LineStyle was changed
obj.InitializeToggle = true;
end
function set.LineWidth(obj, value)
% Set property
obj.LineWidth = value;
% Toggle re-initialize to true if LineWidth was changed
obj.InitializeToggle = true;
end
function set.LineTransparency(obj, value)
% Set property
obj.LineTransparency = value;
% Toggle re-initialize to true if LineTransparency was changed
obj.InitializeToggle = true;
end
function set.Marker(obj, value)
% Set property
obj.Marker = value;
% Toggle re-initialize to true if Marker was changed
obj.InitializeToggle = true;
end
function set.MarkerSize(obj, value)
% Set property
obj.MarkerSize = value;
% Toggle re-initialize to true if MarkerSize was changed
obj.InitializeToggle = true;
end
function set.MarkerTransparency(obj, value)
% Set property
obj.MarkerTransparency = value;
% Toggle re-initialize to true if MarkerTransparency was changed
obj.InitializeToggle = true;
end
function set.AxesFont(obj, value)
% Set property
obj.AxesFont = value;
% Toggle re-initialize to true if AxesFont was changed
obj.InitializeToggle = true;
end
function set.LabelFont(obj, value)
% Set property
obj.LabelFont = value;
% Toggle re-initialize to true if LabelFont was changed
obj.InitializeToggle = true;
end
function set.AxesFontSize(obj, value)
% Set property
obj.AxesFontSize = value;
% Toggle re-initialize to true if AxesFontSize was changed
obj.InitializeToggle = true;
end
function set.AxesFontColor(obj, value)
% Set property
obj.AxesFontColor = value;
% Toggle re-initialize to true if AxesFontColor was changed
obj.InitializeToggle = true;
end
function set.LabelFontSize(obj, value)
% Set property
obj.LabelFontSize = value;
% Toggle re-initialize to true if LabelFontSize was changed
obj.InitializeToggle = true;
end
function set.Direction(obj, value)
% Set property
obj.Direction = value;
% Toggle re-initialize to true if Direction was changed
obj.InitializeToggle = true;
end
function set.AxesDirection(obj, value)
% Set property
obj.AxesDirection = value;
% Toggle re-initialize to true if Direction was changed
obj.InitializeToggle = true;
end
function set.AxesLabelsOffset(obj, value)
% Set property
obj.AxesLabelsOffset = value;
% Toggle re-initialize to true if AxesLabelsOffset was changed
obj.InitializeToggle = true;
end
function set.AxesScaling(obj, value)
% Set property
obj.AxesScaling = value;
% Toggle re-initialize to true if AxesScaling was changed
obj.InitializeToggle = true;
end
function set.AxesColor(obj, value)
% Set property
obj.AxesColor = value;
% Toggle re-initialize to true if AxesColor was changed
obj.InitializeToggle = true;
end
function set.AxesLabelsEdge(obj, value)
% Set property
obj.AxesLabelsEdge = value;
% Toggle re-initialize to true if AxesLabelsEdge was changed
obj.InitializeToggle = true;
end
function set.AxesOffset(obj, value)
% Set property
obj.AxesOffset = value;
% Toggle re-initialize to true if AxesOffset was changed
obj.InitializeToggle = true;
end
function set.AxesZoom(obj, value)
% Set property
obj.AxesZoom = value;
% Toggle re-initialize to true if AxesZoom was changed
obj.InitializeToggle = true;
end
function set.AxesHorzAlign(obj, value)
% Set property
obj.AxesHorzAlign = value;
% Toggle re-initialize to true if AxesHorzAlign was changed
obj.InitializeToggle = true;
end
function set.AxesVertAlign(obj, value)
% Set property
obj.AxesVertAlign = value;
% Toggle re-initialize to true if AxesVertAlign was changed
obj.InitializeToggle = true;
end
function set.AxesTickLabels(obj, value)
% Set property
obj.AxesTickLabels = value;
% Toggle re-initialize to true if AxesTickLabels was changed
obj.InitializeToggle = true;
end
function set.AxesInterpreter(obj, value)
% Set property
obj.AxesInterpreter = value;
% Toggle re-initialize to true if AxesInterpreter was changed
obj.InitializeToggle = true;
end
function set.AxesTickInterpreter(obj, value)
% Set property
obj.AxesTickInterpreter = value;
% Toggle re-initialize to true if AxesTickInterpreter was changed
obj.InitializeToggle = true;
end
function set.BackgroundColor(obj, value)
% Set property
obj.BackgroundColor = value;
% Toggle re-initialize to true if BackgroundColor was changed
obj.InitializeToggle = true;
end
function set.MinorGrid(obj, value)
% Set property
obj.MinorGrid = value;
% Toggle re-initialize to true if MinorGrid was changed
obj.InitializeToggle = true;
end
function set.MinorGridInterval(obj, value)
% Set property
obj.MinorGridInterval = value;
% Toggle re-initialize to true if MinorGridInterval was changed
obj.InitializeToggle = true;
end
function set.AxesZero(obj, value)
% Set property
obj.AxesZero = value;
% Toggle re-initialize to true if AxesZero was changed
obj.InitializeToggle = true;
end
function set.AxesZeroColor(obj, value)
% Set property
obj.AxesZeroColor = value;
% Toggle re-initialize to true if AxesZeroColor was changed
obj.InitializeToggle = true;
end
function set.AxesZeroWidth(obj, value)
% Set property
obj.AxesZeroWidth = value;
% Toggle re-initialize to true if AxesZeroWidth was changed
obj.InitializeToggle = true;
end
function set.AxesRadial(obj, value)
% Set property
obj.AxesRadial = value;
% Toggle re-initialize to true if AxesRadial was changed
obj.InitializeToggle = true;
end
function set.AxesWeb(obj, value)
% Set property
obj.AxesWeb = value;
% Toggle re-initialize to true if AxesWeb was changed
obj.InitializeToggle = true;
end
function set.AxesShaded(obj, value)
% Set property
obj.AxesShaded = value;
% Toggle re-initialize to true if AxesShaded was changed
obj.InitializeToggle = true;
end
function set.AxesShadedLimits(obj, value)
% Set property
obj.AxesShadedLimits = value;
% Toggle re-initialize to true if AxesShadedLimits was changed
obj.InitializeToggle = true;
end
function set.AxesShadedColor(obj, value)
% Set property
obj.AxesShadedColor = value;
% Toggle re-initialize to true if AxesShadedColor was changed
obj.InitializeToggle = true;
end
function set.AxesShadedTransparency(obj, value)
% Set property
obj.AxesShadedTransparency = value;
% Toggle re-initialize to true if AxesShadedTransparency was changed
obj.InitializeToggle = true;
end
function set.ErrorBars(obj, value)
% Set property
obj.ErrorBars = value;
% Toggle re-initialize to true if ErrorBars was changed
obj.InitializeToggle = true;
end
function set.AxesTickFormat(obj, value)
% Set property
obj.AxesTickFormat = value;
% Toggle re-initialize to true if AxesTickFormat was changed
obj.InitializeToggle = true;
end
function set.FillCData(obj, value)
% Set property
obj.FillCData = value;
% Toggle re-initialize to true if FillCData was changed
obj.InitializeToggle = true;
end
function set.AxesStart(obj, value)
% Set property
obj.AxesStart = value;
% Toggle re-initialize to true if AxesStart was changed
obj.InitializeToggle = true;
end
function set.ErrorPositive(obj, value)
% Set property
obj.ErrorPositive = value;
% Toggle re-initialize to true if ErrorPositive was changed
obj.InitializeToggle = true;
end
function set.ErrorNegative(obj, value)
% Set property
obj.ErrorNegative = value;
% Toggle re-initialize to true if ErrorNegative was changed
obj.InitializeToggle = true;
end
%%% Get Methods %%%
function num_data_points = get.NumDataPoints(obj)
% Get number of data points
num_data_points = size(obj.P, 2);
end
function num_data_groups = get.NumDataGroups(obj)
% Get number of data groups
num_data_groups = size(obj.P, 1);
end
function axes_labels = get.AxesLabels(obj)
% Check if value is empty
if isempty(obj.AxesLabels)
% Set axes labels
axes_labels = cellstr("Label " + (1:obj.NumDataPoints));
else
% Keep axes labels
axes_labels = obj.AxesLabels;
end
end
function legend_labels = get.LegendLabels(obj)
% Check if value is empty
if isempty(obj.LegendLabels)
% Check error bar status
if strcmp(obj.ErrorBars, 'on')
% Set legend labels
legend_labels = {'Data 1'};
else
% Set legend labels
legend_labels = cellstr("Data " + (1:obj.NumDataGroups));
end
else
% Keep legend labels
legend_labels = obj.LegendLabels;
end
end
function color = get.Color(obj)
% Check if value is empty
if isempty(obj.Color)
% Set color order
color = lines(obj.NumDataGroups);
elseif size(obj.Color, 1) < obj.NumDataGroups
% Set color order
color = lines(obj.NumDataGroups);
else
% Keep color order
color = obj.Color;
end
end
function axes_limits = get.AxesLimits(obj)
% Check if value is empty
if isempty(obj.AxesLimits)
% Replace Inf with NaN
P_limits = obj.P;
inf_index = isinf(P_limits);
P_limits(inf_index) = nan;
% Default arguments
axes_limits = [min(P_limits, [], 1); max(P_limits, [], 1)];
else
% Validate axes limits
validateAxesLimits(obj.AxesLimits, obj.P);
% Get property
axes_limits = obj.AxesLimits;
end
end
function axes_shaded_limits = get.AxesShadedLimits(obj)
% Get property
if isempty(obj.AxesShadedLimits)
axes_shaded_limits = {obj.AxesLimits};
else
% Iterate through axes shaded limits
for ii = 1:length(obj.AxesShadedLimits)
% Initialize
axes_shaded_limit = obj.AxesShadedLimits{ii};
% Check if the axes shaded limits same length as the number of points
if size(axes_shaded_limit, 1) ~= 2 || size(axes_shaded_limit, 2) ~= obj.NumDataPoints
error('Error: Please make sure the min and max axes shaded limits match the number of data points.');
end
% Check if within min and max axes limits
if any(axes_shaded_limit(1, :) < obj.AxesLimits(1, :)) ||...
any(axes_shaded_limit(2, :) > obj.AxesLimits(2, :))
error('Error: Please make sure the axes shaded limits are within the min and max axes limits.');
end
end
% Get property
axes_shaded_limits = obj.AxesShadedLimits;
end
end
function axes_shaded_color = get.AxesShadedColor(obj)
% Check if axes shaded color is a char
if ischar(obj.AxesShadedColor)
% Convert to cell array of char
obj.AxesShadedColor = cellstr(obj.AxesShadedColor);
% Repeat cell to number of axes shaded limits groups
obj.AxesShadedColor = repmat(obj.AxesShadedColor, length(obj.AxesShadedLimits), 1);
elseif iscellstr(obj.AxesShadedColor)
% Check is length is one
if length(obj.AxesShadedColor) == 1
% Repeat cell to number of axes shaded limits groups
obj.AxesShadedColor = repmat(obj.AxesShadedColor, length(obj.AxesShadedLimits), 1);
end
end
% Check if axes shaded color is valid
if length(obj.AxesShadedColor) ~= length(obj.AxesShadedLimits)
error('Error: Please specify the same number of axes shaded color as number of axes shaded limits groups.');
end
% Get property
axes_shaded_color = obj.AxesShadedColor;
end
function axes_shaded_transparency = get.AxesShadedTransparency(obj)
% Check is length is one
if length(obj.AxesShadedTransparency) == 1
% Repeat array to number of axes shaded limits groups
obj.AxesShadedTransparency = repmat(obj.AxesShadedTransparency, length(obj.AxesShadedLimits), 1);
elseif length(obj.AxesShadedTransparency) ~= length(obj.AxesShadedLimits)
error('Error: Please specify the same number of axes shaded transparency as number axes shaded limits groups.');
end
% Get property
axes_shaded_transparency = obj.AxesShadedTransparency;
end
function axes_precision = get.AxesPrecision(obj)
% Check if axes precision is numeric
if isnumeric(obj.AxesPrecision)
% Check is length is one
if length(obj.AxesPrecision) == 1
% Repeat array to number of data points
obj.AxesPrecision = repmat(obj.AxesPrecision, obj.NumDataPoints, 1);
elseif length(obj.AxesPrecision) ~= obj.NumDataPoints
error('Error: Please specify the same number of axes precision as number of data points.');
end
else
error('Error: Please make sure the axes precision is a numeric value.');
end
% Get property
axes_precision = obj.AxesPrecision;
end
function axes_scaling = get.AxesScaling(obj)
% Check if axes scaling is valid
if any(~ismember(obj.AxesScaling, {'linear', 'log'}))
error('Error: Invalid axes scaling entry. Please enter in "linear" or "log" to set axes scaling.');
end
% Check if axes scaling is a cell
if iscell(obj.AxesScaling)
% Check is length is one
if length(obj.AxesScaling) == 1
% Repeat array to number of data groups
obj.AxesScaling = repmat(obj.AxesScaling, obj.NumDataPoints, 1);
elseif length(obj.AxesScaling) ~= obj.NumDataPoints
error('Error: Please specify the same number of axes scaling as number of data points.');
end
else
% Repeat array to number of data groups
obj.AxesScaling = repmat({obj.AxesScaling}, obj.NumDataPoints, 1);
end
% Get property
axes_scaling = obj.AxesScaling;
end
function line_style = get.LineStyle(obj)
% Check if line style is a char
if ischar(obj.LineStyle)
% Convert to cell array of char
obj.LineStyle = cellstr(obj.LineStyle);
% Repeat cell to number of data groups
obj.LineStyle = repmat(obj.LineStyle, obj.NumDataGroups, 1);
elseif iscellstr(obj.LineStyle) %#ok<*ISCLSTR>
% Check is length is one
if length(obj.LineStyle) == 1
% Repeat cell to number of data groups
obj.LineStyle = repmat(obj.LineStyle, obj.NumDataGroups, 1);
elseif length(obj.LineStyle) ~= obj.NumDataGroups
error('Error: Please specify the same number of line styles as number of data groups.');
end
else
error('Error: Please make sure the line style is a char or a cell array of char.');
end
% Get property
line_style = obj.LineStyle;
end
function line_width = get.LineWidth(obj)
% Check if line width is numeric
if isnumeric(obj.LineWidth)
% Check is length is one
if length(obj.LineWidth) == 1
% Repeat array to number of data groups
obj.LineWidth = repmat(obj.LineWidth, obj.NumDataGroups, 1);
elseif length(obj.LineWidth) ~= obj.NumDataGroups
error('Error: Please specify the same number of line width as number of data groups.');
end
else
error('Error: Please make sure the line width is a numeric value.');
end
% Get property
line_width = obj.LineWidth;
end
function marker_style = get.Marker(obj)
% Check if marker type is a char
if ischar(obj.Marker)
% Convert to cell array of char
obj.Marker = cellstr(obj.Marker);
% Repeat cell to number of data groups
obj.Marker = repmat(obj.Marker, obj.NumDataGroups, 1);
elseif iscellstr(obj.Marker)
% Check is length is one
if length(obj.Marker) == 1
% Repeat cell to number of data groups
obj.Marker = repmat(obj.Marker, obj.NumDataGroups, 1);
elseif length(obj.Marker) ~= obj.NumDataGroups
error('Error: Please specify the same number of line styles as number of data groups.');
end
else
error('Error: Please make sure the line style is a char or a cell array of char.');
end
% Get property
marker_style = obj.Marker;
end
function marker_size = get.MarkerSize(obj)
% Check if line width is numeric
if isnumeric(obj.MarkerSize)
if length(obj.MarkerSize) == 1
% Repeat array to number of data groups
obj.MarkerSize = repmat(obj.MarkerSize, obj.NumDataGroups, 1);
elseif length(obj.MarkerSize) ~= obj.NumDataGroups
error('Error: Please specify the same number of line width as number of data groups.');
end
else
error('Error: Please make sure the line width is numeric.');
end
% Get property
marker_size = obj.MarkerSize;
end
function axes_direction = get.AxesDirection(obj)
% Check if axes direction is a cell
if iscell(obj.AxesDirection)
% Check is length is one
if length(obj.AxesDirection) == 1
% Repeat array to number of data points
obj.AxesDirection = repmat(obj.AxesDirection, obj.NumDataPoints, 1);
elseif length(obj.AxesDirection) ~= obj.NumDataPoints
error('Error: Please specify the same number of axes direction as number of data points.');
end
else
% Repeat array to number of data points
obj.AxesDirection = repmat({obj.AxesDirection}, obj.NumDataPoints, 1);
end
% Get property
axes_direction = obj.AxesDirection;
end
function axes_offset = get.AxesOffset(obj)
% Check if axes offset is valid
if obj.AxesOffset > obj.AxesInterval
error('Error: Invalid axes offset entry. Please enter in an integer value that is between [0, axes_interval].');
end
% Get property
axes_offset = obj.AxesOffset;
end
function fill_option = get.FillOption(obj)
% Check if fill option is a cell
if iscell(obj.FillOption)
% Check is length is one
if length(obj.FillOption) == 1
% Repeat array to number of data groups
obj.FillOption = repmat(obj.FillOption, obj.NumDataGroups, 1);
elseif length(obj.FillOption) ~= obj.NumDataGroups
error('Error: Please specify the same number of fill options as number of data groups.');
end
else
% Repeat array to number of data groups
obj.FillOption = repmat({obj.FillOption}, obj.NumDataGroups, 1);
end
% Check fill data
if any(strcmp(obj.FillOption, 'interp'))
if isempty(obj.FillCData)
error('Error: Please enter in a valid fill cdata.');
else
if length(obj.FillCData) ~= obj.NumDataPoints
error('Error: Please make sure that fill cdata matches the number of data points.');
end
end
end
% Get property
fill_option = obj.FillOption;
end
function fill_transparency = get.FillTransparency(obj)
% Check if fill transparency is numeric
if isnumeric(obj.FillTransparency)
% Check is length is one
if length(obj.FillTransparency) == 1
% Repeat array to number of data groups
obj.FillTransparency = repmat(obj.FillTransparency, obj.NumDataGroups, 1);
elseif length(obj.FillTransparency) ~= obj.NumDataGroups
error('Error: Please specify the same number of fill transparency as number of data groups.');
end
else
error('Error: Please make sure the fill transparency is a numeric value.');
end
% Get property
fill_transparency = obj.FillTransparency;
end
function line_transparency = get.LineTransparency(obj)
% Check if line transparency is numeric
if isnumeric(obj.LineTransparency)
% Check is length is one
if length(obj.LineTransparency) == 1
% Repeat array to number of data groups
obj.LineTransparency = repmat(obj.LineTransparency, obj.NumDataGroups, 1);
elseif length(obj.LineTransparency) ~= obj.NumDataGroups
error('Error: Please specify the same number of line transparency as number of data groups.');
end
else
error('Error: Please make sure the line transparency is a numeric value.');
end
% Get property
line_transparency = obj.LineTransparency;
end
function marker_transparency = get.MarkerTransparency(obj)
% Check if marker transparency is numeric
if isnumeric(obj.MarkerTransparency)
% Check is length is one
if length(obj.MarkerTransparency) == 1
% Repeat array to number of data groups
obj.MarkerTransparency = repmat(obj.MarkerTransparency, obj.NumDataGroups, 1);
elseif length(obj.MarkerTransparency) ~= obj.NumDataGroups
error('Error: Please specify the same number of marker transparency as number of data groups.');
end
else
error('Error: Please make sure the marker transparency is a numeric value.');
end
% Get property
marker_transparency = obj.MarkerTransparency;
end
function axes_font_color = get.AxesFontColor(obj)
% Check if axes display is data
if ismember(obj.AxesDisplay, {'data', 'data-percent'})
if size(obj.AxesFontColor, 1) ~= obj.NumDataGroups
% Check axes font color dimensions
if size(obj.AxesFontColor, 1) == 1 && size(obj.AxesFontColor, 2) == 3
obj.AxesFontColor = repmat(obj.AxesFontColor, obj.NumDataGroups, 1);
else
error('Error: Please specify axes font color as a RGB triplet normalized to 1.');
end
end
end
% Get property
axes_font_color = obj.AxesFontColor;
end
function axes_tick_text = get.AxesTickLabels(obj)
% Check if axes tick labels is valid
if iscell(obj.AxesTickLabels)
if length(obj.AxesTickLabels) ~= obj.AxesInterval+1
error('Error: Invalid axes tick labels entry. Please enter in a cell array with the same length of axes interval + 1.');
end
else
if ~strcmp(obj.AxesTickLabels, 'data')
error('Error: Invalid axes tick labels entry. Please enter in "data" or a cell array of desired tick labels.');
end
end
% Get property
axes_tick_text = obj.AxesTickLabels;
end
function axes_interpreter = get.AxesInterpreter(obj)
% Check if axes interpreter is valid
if any(~ismember(obj.AxesInterpreter, {'tex', 'latex', 'none'}))
error('Error: Please enter either "tex", "latex", or "none" for axes interpreter option.');
end
% Check if axes interpreter is a char
if ischar(obj.AxesInterpreter)
% Convert to cell array of char
obj.AxesInterpreter = cellstr(obj.AxesInterpreter);
% Repeat cell to number of axes labels
obj.AxesInterpreter = repmat(obj.AxesInterpreter, length(obj.AxesLabels), 1);
elseif iscellstr(obj.AxesInterpreter)
% Check is length is one
if length(obj.AxesInterpreter) == 1
% Repeat cell to number of axes labels
obj.AxesInterpreter = repmat(obj.AxesInterpreter, length(obj.AxesLabels), 1);
elseif length(obj.AxesInterpreter) ~= length(obj.AxesLabels)
error('Error: Please specify the same number of axes interpreters as number of axes labels.');
end
else
error('Error: Please make sure the axes interpreter is a char or a cell array of char.');
end