11function marker = extractLineMarker(line_data )
2+ % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
3+ % OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
4+ % STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
25
3- % EXTRACTS THE MARKER STYLE USED FOR MATLAB OBJECTS
4- % OF TYPE "LINE". THESE OBJECTS ARE USED IN LINESERIES,
5- % STAIRSERIES, STEMSERIES, BASELINESERIES, AND BOXPLOTS
6+ % ---------------------------------------------------------------------%
67
7- % -------------------------------------------------------------------------%
8+ % -INITIALIZE OUTPUT-%
9+ marker = struct();
810
9- % -INITIALIZE OUTPUT-%
10- marker = struct();
11+ % ---------------------------------------------------------------------%
1112
12- % -------------------------------------------------------------------------%
13+ % -MARKER SIZE-%
14+ marker.size = line_data .MarkerSize ;
1315
14- % -MARKER SIZE-%
15- marker.size = line_data .MarkerSize ;
16-
17- if length(marker .size ) == 1
18- marker.size = 0.6 * marker .size ;
19- end
20-
21- % -------------------------------------------------------------------------%
22-
23- % -MARKER SYMBOL-%
24- if ~strcmp(line_data .Marker ,' none' )
25-
26- switch line_data .Marker
27- case ' .'
28- marksymbol = ' circle' ;
29- case ' o'
30- marksymbol = ' circle' ;
31- case ' x'
32- marksymbol = ' x-thin-open' ;
33- case ' +'
34- marksymbol = ' cross-thin-open' ;
35- case ' *'
36- marksymbol = ' asterisk-open' ;
37- case {' s' ,' square' }
38- marksymbol = ' square' ;
39- case {' d' ,' diamond' }
40- marksymbol = ' diamond' ;
41- case ' v'
42- marksymbol = ' triangle-down' ;
43- case ' ^'
44- marksymbol = ' triangle-up' ;
45- case ' <'
46- marksymbol = ' triangle-left' ;
47- case ' >'
48- marksymbol = ' triangle-right' ;
49- case {' p' ,' pentagram' }
50- marksymbol = ' star' ;
51- case {' h' ,' hexagram' }
52- marksymbol = ' hexagram' ;
16+ if line_data .Marker == " ." % scale factor for points is off
17+ marker.size = floor(sqrt(marker .size ));
18+ elseif length(marker .size ) == 1
19+ marker.size = 0.6 * marker .size ;
5320 end
54-
55- marker.symbol = marksymbol ;
56- if isfield(line_data , ' MarkerIndices' )
57- marker.maxdisplayed= length(line_data .MarkerIndices )+1 ;
58- end
59- end
6021
61- % -------------------------------------------------------------------------%
22+ % ---------------------------------------------------------------------%
23+
24+ % -MARKER SYMBOL-%
25+ if ~strcmp(line_data .Marker ," none" )
26+ switch line_data .Marker
27+ case " ."
28+ marksymbol = " circle" ;
29+ case " o"
30+ marksymbol = " circle" ;
31+ case " x"
32+ marksymbol = " x-thin-open" ;
33+ case " +"
34+ marksymbol = " cross-thin-open" ;
35+ case " *"
36+ marksymbol = " asterisk-open" ;
37+ case {" s" ," square" }
38+ marksymbol = " square" ;
39+ case {" d" ," diamond" }
40+ marksymbol = " diamond" ;
41+ case " v"
42+ marksymbol = " triangle-down" ;
43+ case " ^"
44+ marksymbol = " triangle-up" ;
45+ case " <"
46+ marksymbol = " triangle-left" ;
47+ case " >"
48+ marksymbol = " triangle-right" ;
49+ case {" p" ," pentagram" }
50+ marksymbol = " star" ;
51+ case {" h" ," hexagram" }
52+ marksymbol = " hexagram" ;
53+ end
54+ marker.symbol = marksymbol ;
55+ if isfield(line_data , " MarkerIndices" )
56+ marker.maxdisplayed= length(line_data .MarkerIndices )+1 ;
57+ end
58+ end
6259
63- % -MARKER LINE WIDTH-%
64- marker.line.width = line_data .LineWidth ;
60+ % ---------------------------------------------------------------------%
6561
66- % -------------------------------------------------------------------------%
62+ % -MARKER LINE WIDTH-%
63+ marker.line.width = line_data .LineWidth ;
6764
68- filledMarkerSet = {' o' ,' square' ,' s' ,' diamond' ,' d' ,...
69- ' v' ,' ^' , ' <' ,' >' ,' hexagram' ,' pentagram' };
65+ % ---------------------------------------------------------------------%
7066
71- filledMarker = ismember(line_data .Marker ,filledMarkerSet );
67+ filledMarkerSet = {" o" ," square" ," s" ," diamond" ," d" ,...
68+ " v" ," ^" , " <" ," >" ," hexagram" ," pentagram" };
7269
73- % -------------------------------------------------------------------------%
70+ filledMarker = ismember( line_data . Marker , filledMarkerSet );
7471
75- % --MARKER FILL COLOR --%
72+ % ------------------------------------------------------------------- --%
7673
77- MarkerColor = line_data .MarkerFaceColor ;
74+ % --MARKER FILL COLOR--%
75+ MarkerColor = line_data .MarkerFaceColor ;
7876
79- if filledMarker
80- if isnumeric(MarkerColor )
81- col = 255 * MarkerColor ;
82- markercolor = [' rgb(' num2str(col(1 )) ' ,' num2str(col(2 )) ' ,' num2str(col(3 )) ' )' ];
83- else
84- switch MarkerColor
85- case ' none'
86- markercolor = ' rgba(0,0,0,0)' ;
87- case ' auto'
88- markercolor = ' rgba(0, 0.4470, 0.7410,1)' ;
77+ if filledMarker
78+ if isnumeric(MarkerColor )
79+ col = 255 * MarkerColor ;
80+ markercolor = sprintf(" rgb(%d,%d,%d)" , col );
81+ else
82+ switch MarkerColor
83+ case " none"
84+ markercolor = " rgba(0,0,0,0)" ;
85+ case " auto"
86+ markercolor = " rgba(0, 0.4470, 0.7410,1)" ;
87+ end
8988 end
89+ marker.color = markercolor ;
9090 end
91-
92- marker.color = markercolor ;
93-
94- end
95-
96- % -------------------------------------------------------------------------%
9791
98- % -MARKER LINE COLOR -%
92+ % -------------------------------------------------------------------- -%
9993
100- MarkerLineColor = line_data .MarkerEdgeColor ;
94+ % -MARKER LINE COLOR-%
95+ MarkerLineColor = line_data .MarkerEdgeColor ;
10196
102- if isnumeric(MarkerLineColor )
103- col = 255 * MarkerLineColor ;
104- markerlinecolor = [' rgb(' num2str(col(1 )) ' ,' num2str(col(2 )) ' ,' num2str(col(3 )) ' )' ];
105- else
106- switch MarkerLineColor
107- case ' none'
108- markerlinecolor = ' rgba(0,0,0,0)' ;
109- case ' auto'
110- col = 255 * line_data .Color ;
111- markerlinecolor = [' rgb(' num2str(col(1 )) ' ,' num2str(col(2 )) ' ,' num2str(col(3 )) ' )' ];
97+ if isnumeric(MarkerLineColor )
98+ col = 255 * MarkerLineColor ;
99+ markerlinecolor = sprintf(" rgb(%d,%d,%d)" , col );
100+ else
101+ switch MarkerLineColor
102+ case " none"
103+ markerlinecolor = " rgba(0,0,0,0)" ;
104+ case " auto"
105+ col = 255 * line_data .Color ;
106+ markerlinecolor = sprintf(" rgb(%d,%d,%d)" , col );
107+ end
112108 end
113- end
114109
115- if filledMarker
116- marker.line.color = markerlinecolor ;
117- else
118- marker.color = markerlinecolor ;
110+ if filledMarker
111+ marker.line.color = markerlinecolor ;
112+ else
113+ marker.color = markerlinecolor ;
114+ end
119115end
120-
121- end
0 commit comments