Skip to content

Commit 0051a43

Browse files
Use getMarkerSymbol everywhere
1 parent 78a836e commit 0051a43

File tree

9 files changed

+85
-276
lines changed

9 files changed

+85
-276
lines changed

plotly/Test_plotlyfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ function testPieChartPlotData(tc)
686686
mode = 'lines', ...
687687
marker = struct( ...
688688
sizeref = 1, ...
689-
sizemode = 'diameter', ...
689+
sizemode = "diameter", ...
690690
size = 6, ...
691691
line = struct( ...
692692
width = 0.5 ...

plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,50 +111,16 @@
111111
end
112112

113113
function markerStruct = getMarker(plotData, traceIndex)
114-
%-INITIALIZATIONS-%
115114
markerStruct = struct();
116115

117-
%-marker color-%
118116
[markerColor, ~] = getColor(plotData.Color, traceIndex, ...
119117
plotData.MarkerTransparency);
120118
markerStruct.color = markerColor;
121119
markerStruct.line.color = markerColor;
122-
123-
%-marker size-%
124120
markerStruct.size = plotData.MarkerSize(traceIndex, 1) * 0.2;
125121

126-
%-marker symbol-%
127-
if ~strcmp(plotData.Marker{traceIndex, 1}, 'none')
128-
switch plotData.Marker{traceIndex, 1}
129-
case '.'
130-
mSymbol = 'circle';
131-
case 'o'
132-
mSymbol = 'circle';
133-
case 'x'
134-
mSymbol = 'x-thin-open';
135-
case '+'
136-
mSymbol = 'cross-thin-open';
137-
case '*'
138-
mSymbol = 'asterisk-open';
139-
case {'s','square'}
140-
mSymbol = 'square';
141-
case {'d','diamond'}
142-
mSymbol = 'diamond';
143-
case 'v'
144-
mSymbol = 'triangle-down';
145-
case '^'
146-
mSymbol = 'triangle-up';
147-
case '<'
148-
mSymbol = 'triangle-left';
149-
case '>'
150-
mSymbol = 'triangle-right';
151-
case {'p','pentagram'}
152-
mSymbol = 'star';
153-
case {'h','hexagram'}
154-
mSymbol = 'hexagram';
155-
end
156-
157-
markerStruct.symbol = mSymbol;
122+
if ~strcmp(plotData.Marker{traceIndex, 1}, "none")
123+
markerStruct.symbol = getMarkerSymbol(plotData.Marker{traceIndex, 1});
158124
end
159125
end
160126

plotly/plotlyfig_aux/helpers/extractGeoLinePlusMarker.m

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
function [marker, linee] = extractGeoLinePlusMarker(geoData, axisData)
2+
figureData = ancestor(geoData.Parent, "figure");
23

3-
%-FIGURE STRUCTURE-%
4-
figureData = ancestor(geoData.Parent,'figure');
5-
6-
%-INITIALIZE OUTPUTS-%
74
marker = struct();
85
linee = struct();
96

10-
%-LINE SETTINGS-%
11-
12-
% line color
137
lineColor = geoData.Color;
14-
158
if isnumeric(lineColor)
169
lineColor = getStringColor(round(255*lineColor));
1710
else
1811
switch lineColor
19-
case 'none'
12+
case "none"
2013
lineColor = "rgba(0,0,0,0)";
21-
case {'auto', 'manual'}
14+
case {"auto", "manual"}
2215
lineColor = getStringColor(round(255*lineColor));
23-
case 'flat'
16+
case "flat"
2417
cData = geoData.CData;
2518
cMap = figureData.Colormap;
2619
ncolors = size(cMap, 1);
@@ -41,49 +34,15 @@
4134
linee.dash = getLineDash(geoData.LineStyle);
4235

4336
marker.sizeref = 1;
44-
marker.sizemode = 'area';
37+
marker.sizemode = "area";
4538
marker.size = geoData.MarkerSize;
4639

47-
%-MARKER SYMBOL (STYLE)-%
48-
if ~strcmp(geoData.Marker, 'none')
49-
switch geoData.Marker
50-
case '.'
51-
marksymbol = 'circle';
52-
case 'o'
53-
marksymbol = 'circle';
54-
case 'x'
55-
marksymbol = 'x-thin-open';
56-
case '+'
57-
marksymbol = 'cross-thin-open';
58-
case '*'
59-
marksymbol = 'asterisk-open';
60-
case {'s','square'}
61-
marksymbol = 'square';
62-
case {'d','diamond'}
63-
marksymbol = 'diamond';
64-
case 'v'
65-
marksymbol = 'triangle-down';
66-
case '^'
67-
marksymbol = 'star-triangle-up';
68-
case '<'
69-
marksymbol = 'triangle-left';
70-
case '>'
71-
marksymbol = 'triangle-right';
72-
case {'p','pentagram'}
73-
marksymbol = 'star';
74-
case {'h','hexagram'}
75-
marksymbol = 'hexagram';
76-
end
77-
78-
marker.symbol = marksymbol;
40+
if ~strcmp(geoData.Marker, "none")
41+
marker.symbol = getMarkerSymbol(geoData.Marker);
7942
end
8043

81-
%-MARKER LINE WIDTH (STYLE)-%
8244
marker.line.width = 2*geoData.LineWidth;
8345

84-
%--MARKER FILL COLOR--%
85-
86-
% marker face color
8746
faceColor = geoData.MarkerFaceColor;
8847

8948
filledMarkerSet = {'o','square','s','diamond','d','v','^', '<', ...
@@ -95,19 +54,20 @@
9554
markerColor = getStringColor(round(255*faceColor));
9655
else
9756
switch faceColor
98-
case 'none'
57+
case "none"
9958
markerColor = "rgba(0,0,0,0)";
100-
case 'auto'
101-
if ~strcmp(axisData.Color,'none')
59+
case "auto"
60+
if ~strcmp(axisData.Color,"none")
10261
col = round(255*axisData.Color);
10362
else
10463
col = round(255*figureData.Color);
10564
end
10665
markerColor = getStringColor(col);
107-
case 'flat'
66+
case "flat"
10867
cData = geoData.CData;
10968
cMap = figureData.Colormap;
11069
ncolors = size(cMap, 1);
70+
markerColor = cell(1, length(cData));
11171
for m = 1:length(cData)
11272
colorValue = max(min(cData(m), ...
11373
axisData.CLim(2)), axisData.CLim(1));
@@ -122,23 +82,20 @@
12282
marker.color = markerColor;
12383
end
12484

125-
%-MARKER LINE COLOR-%
126-
127-
% marker edge color
12885
edgeColor = geoData.MarkerEdgeColor;
129-
13086
if isnumeric(edgeColor)
13187
lineColor = getStringColor(round(255*edgeColor));
13288
else
13389
switch edgeColor
134-
case 'none'
90+
case "none"
13591
lineColor = "rgba(0,0,0,0)";
136-
case 'auto'
92+
case "auto"
13793
lineColor = getStringColor(round(255*geoData.Color));
138-
case 'flat'
94+
case "flat"
13995
cData = geoData.CData;
14096
cMap = figureData.Colormap;
14197
ncolors = size(cMap, 1);
98+
lineColor = cell(1,length(cData));
14299
for m = 1:length(cData)
143100
colorValue = max(min(cData(m), axisData.CLim(2)), ...
144101
axisData.CLim(1));

plotly/plotlyfig_aux/helpers/extractGeoMarker.m

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,8 @@
1010
marker.size = geoData.SizeData;
1111

1212
%-MARKER SYMBOL (STYLE)-%
13-
if ~strcmp(geoData.Marker, 'none')
14-
switch geoData.Marker
15-
case '.'
16-
marksymbol = 'circle';
17-
case 'o'
18-
marksymbol = 'circle';
19-
case 'x'
20-
marksymbol = 'x-thin-open';
21-
case '+'
22-
marksymbol = 'cross-thin-open';
23-
case '*'
24-
marksymbol = 'asterisk-open';
25-
case {'s','square'}
26-
marksymbol = 'square';
27-
case {'d','diamond'}
28-
marksymbol = 'diamond';
29-
case 'v'
30-
marksymbol = 'triangle-down';
31-
case '^'
32-
marksymbol = 'star-triangle-up';
33-
case '<'
34-
marksymbol = 'triangle-left';
35-
case '>'
36-
marksymbol = 'triangle-right';
37-
case {'p','pentagram'}
38-
marksymbol = 'star';
39-
case {'h','hexagram'}
40-
marksymbol = 'hexagram';
41-
end
42-
43-
marker.symbol = marksymbol;
13+
if ~strcmp(geoData.Marker, "none")
14+
marker.symbol = getMarkerSymbol(geoData.Marker);
4415
end
4516

4617
%-MARKER LINE WIDTH (STYLE)-%

plotly/plotlyfig_aux/helpers/extractLineMarker.m

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,7 @@
1717

1818
%-MARKER SYMBOL-%
1919
if ~strcmp(line_data.Marker, "none")
20-
switch line_data.Marker
21-
case "."
22-
marksymbol = "circle";
23-
case "o"
24-
marksymbol = "circle";
25-
case "x"
26-
marksymbol = "x-thin-open";
27-
case "+"
28-
marksymbol = "cross-thin-open";
29-
case "*"
30-
marksymbol = "asterisk-open";
31-
case {"s","square"}
32-
marksymbol = "square";
33-
case {"d","diamond"}
34-
marksymbol = "diamond";
35-
case "v"
36-
marksymbol = "triangle-down";
37-
case "^"
38-
marksymbol = "triangle-up";
39-
case "<"
40-
marksymbol = "triangle-left";
41-
case ">"
42-
marksymbol = "triangle-right";
43-
case {"p","pentagram"}
44-
marksymbol = "star";
45-
case {"h","hexagram"}
46-
marksymbol = "hexagram";
47-
end
48-
marker.symbol = marksymbol;
20+
marker.symbol = getMarkerSymbol(line_data.Marker);
4921
if isfield(line_data, "MarkerIndices")
5022
marker.maxdisplayed=length(line_data.MarkerIndices)+1;
5123
end

0 commit comments

Comments
 (0)