Skip to content

Commit 78a836e

Browse files
Use getLineDash everywhere
1 parent 334e07b commit 78a836e

18 files changed

+42
-226
lines changed

plotly/plotlyfig_aux/handlegraphics/updateBoxplot.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,6 @@
182182
ydata = obj.data{boxIndex}.y;
183183
end
184184

185-
%----------------------------!AXIS UPDATE!----------------------------%
186-
187185
% take first text object as prototype for axis tick style/layout
188186
text_child = findobj(obj.State.Plot(boxIndex).Handle, 'Type', 'text');
189187

plotly/plotlyfig_aux/handlegraphics/updateComet.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ function updateComet(obj,plotIndex)
145145
scene.aspectratio.y = 1.0*xyar;
146146
scene.aspectratio.z = zar;
147147

148-
%-----------------------------------------------------------------%
149-
150148
%-camera eye-%
151149
ey = obj.PlotOptions.CameraEye;
152150

@@ -181,8 +179,6 @@ function updateComet(obj,plotIndex)
181179
scene.camera.eye.z = zar + zfac*zar;
182180
end
183181

184-
%-----------------------------------------------------------------%
185-
186182
%-scene axis configuration-%
187183

188184
scene.xaxis.range = axisData.XLim;
@@ -230,8 +226,6 @@ function updateComet(obj,plotIndex)
230226
scene.yaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
231227
scene.zaxis.tickfont.family = matlab2plotlyfont(axisData.FontName);
232228

233-
%-----------------------------------------------------------------%
234-
235229
%-SET SCENE TO LAYOUT-%
236230
obj.layout.("scene" + xsource) = scene;
237231
end

plotly/plotlyfig_aux/handlegraphics/updateContourgroup.m

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,9 @@
8282
lineColor = "rgba(0,0,0,0)";
8383
end
8484

85-
switch plotData.LineStyle
86-
case "-"
87-
lineStyle = "solid";
88-
case "--"
89-
lineStyle = "dash";
90-
case ":"
91-
lineStyle = "dot";
92-
case "-."
93-
lineStyle = "dashdot";
94-
end
95-
9685
contourLine = struct( ...
9786
"width", 1.5*plotData.LineWidth, ...
98-
"dash", lineStyle, ...
87+
"dash", getLineDash(plotData.LineStyle), ...
9988
"color", lineColor, ...
10089
"smoothing", 0 ...
10190
);

plotly/plotlyfig_aux/handlegraphics/updateFmesh.m

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
fac = 1/(length(cMap)-1);
7171
colorScale = {};
7272

73-
for c = 1: length(cMap)
73+
for c = 1:length(cMap)
7474
colorScale{c} = {(c-1)*fac, getStringColor(round(255*cMap(c, :)))};
7575
end
7676
%-get edge color-%
@@ -96,8 +96,8 @@
9696

9797
[cDataSurface, cMapSurface] = rgb2ind(cDataSurface, 256);
9898

99-
for c = 1: size(cMapSurface, 1)
100-
colorScale{c} = { (c-1)*fac , getStringColor(round(255*cMapSurface(c, :)), 1)};
99+
for c = 1:size(cMapSurface, 1)
100+
colorScale{c} = {(c-1)*fac, getStringColor(round(255*cMapSurface(c, :)), 1)};
101101
end
102102

103103
obj.data{surfaceIndex}.cmin = 0;
@@ -121,18 +121,12 @@
121121
end
122122
end
123123

124-
%-set face color-%
125124
obj.data{surfaceIndex}.colorscale = colorScale;
126125
obj.data{surfaceIndex}.surfacecolor = cDataSurface;
127126

128-
%-lighting settings-%
129-
130127
if isnumeric(meshData.FaceColor) && all(meshData.FaceColor == [1, 1, 1])
131128
obj.data{surfaceIndex}.lighting.diffuse = 0.5;
132129
obj.data{surfaceIndex}.lighting.ambient = 0.725;
133-
else
134-
% obj.data{surfaceIndex}.lighting.diffuse = 1.0;
135-
% obj.data{surfaceIndex}.lighting.ambient = 0.9;
136130
end
137131

138132
if meshData.FaceAlpha ~= 1
@@ -145,25 +139,11 @@
145139
obj.data{surfaceIndex}.lighting.ambient = 0.3;
146140
end
147141

148-
%-opacity-%
149142
obj.data{surfaceIndex}.opacity = meshData.FaceAlpha;
150143

151-
%-line style-%
152-
153144
obj.data{contourIndex}.line.width = 3*meshData.LineWidth;
145+
obj.data{contourIndex}.line.dash = getLineDash(meshData.LineStyle);
154146

155-
switch meshData.LineStyle
156-
case '-'
157-
obj.data{contourIndex}.line.dash = 'solid';
158-
case '--'
159-
obj.data{contourIndex}.line.dash = 'dash';
160-
case '-.'
161-
obj.data{contourIndex}.line.dash = 'dashdot';
162-
case ':'
163-
obj.data{contourIndex}.line.dash = 'dot';
164-
end
165-
166-
%-show contours-%
167147

168148
if strcmpi(meshData.ShowContours, 'on')
169149
obj.PlotOptions.nPlots = obj.PlotOptions.nPlots + 1;
@@ -188,8 +168,6 @@
188168
end
189169

190170
%-SCENE CONFIGURATION-%
191-
192-
%-aspect ratio-%
193171
asr = obj.PlotOptions.AspectRatio;
194172

195173
if ~isempty(asr)

plotly/plotlyfig_aux/handlegraphics/updateFunctionContour.m

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,7 @@
7979
end
8080

8181
data.line.width = contour_data.LineWidth;
82-
83-
switch contour_data.LineStyle
84-
case "-"
85-
LineStyle = "solid";
86-
case "--"
87-
LineStyle = "dash";
88-
case ":"
89-
LineStyle = "dot";
90-
case "-."
91-
LineStyle = "dashdot";
92-
end
93-
data.line.dash = LineStyle;
82+
data.line.dash = getLineDash(contour_data.LineStyle);
9483
data.line.smoothing = 0;
9584
else
9685
data.contours.showlines = false;

plotly/plotlyfig_aux/handlegraphics/updateFunctionSurface.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,7 @@
109109

110110
surfaceData.opacity = meshData.FaceAlpha;
111111
contourData.line.width = 3*meshData.LineWidth;
112-
113-
switch meshData.LineStyle
114-
case "-"
115-
contourData.line.dash = "solid";
116-
case "--"
117-
contourData.line.dash = "dash";
118-
case "-."
119-
contourData.line.dash = "dashdot";
120-
case ":"
121-
contourData.line.dash = "dot";
122-
end
112+
contourData.line.dash = getLineDash(meshData.LineStyle);
123113

124114
switch meshData.Annotation.LegendInformation.IconDisplayStyle
125115
case "on"

plotly/plotlyfig_aux/handlegraphics/updateGeobubble.m

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ function updateGeobubble(obj,geoIndex)
5757
p = obj.PlotOptions.nPlots;
5858
end
5959

60-
%-----------------------------------------------------------------%
61-
6260
%-set current trace-%
6361
if strcmpi(obj.PlotOptions.geoRenderType, 'geo')
6462
obj.data{p}.type = 'scattergeo';
@@ -71,14 +69,10 @@ function updateGeobubble(obj,geoIndex)
7169

7270
obj.data{p}.mode = 'markers';
7371

74-
%-----------------------------------------------------------------%
75-
7672
%-set current trace data-%
7773
obj.data{p}.lat = lat{g};
7874
obj.data{p}.lon = lon{g};
7975

80-
%-----------------------------------------------------------------%
81-
8276
%-set trace marker-%
8377
marker = struct();
8478
marker.size = sData{g}*1.25;
@@ -87,8 +81,6 @@ function updateGeobubble(obj,geoIndex)
8781

8882
obj.data{p}.marker = marker;
8983

90-
%-----------------------------------------------------------------%
91-
9284
%-legend-%
9385
if byGroups
9486
obj.data{p}.name = group{g};
@@ -204,8 +196,6 @@ function updateGeobubble(obj,geoIndex)
204196
obj.layout.annotations{1}.font.size = 1.5*geoData.FontSize;
205197
end
206198

207-
%---------------------------------------------------------------------%
208-
209199
%-setting legend-%
210200
if byGroups
211201
obj.layout.showlegend = true;

plotly/plotlyfig_aux/handlegraphics/updatePatch.m

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
obj.data{patchIndex}.x = xnew;
8383
end
8484

85-
%-----------------------------------------------------------------%
86-
8785
%-patch y-%
8886
ydata = patch_data.YData;
8987
if isvector(ydata)
@@ -96,8 +94,6 @@
9694
obj.data{patchIndex}.y = ynew;
9795
end
9896

99-
%-----------------------------------------------------------------%
100-
10197
%-patch z-%
10298
if any(nonzeros(patch_data.ZData))
10399
zdata = patch_data.ZData;
@@ -112,13 +108,9 @@
112108
end
113109
end
114110

115-
%-----------------------------------------------------------------%
116-
117111
obj.data{patchIndex}.name = patch_data.DisplayName;
118112
obj.data{patchIndex}.visible = strcmp(patch_data.Visible,'on');
119113

120-
%-----------------------------------------------------------------%
121-
122114
%-patch fill-%
123115
obj.data{patchIndex}.fill = 'tozeroy';
124116

@@ -138,8 +130,6 @@
138130
obj.data{patchIndex}.marker = extractPatchMarker(patch_data);
139131
obj.data{patchIndex}.line = extractPatchLine(patch_data);
140132

141-
%-----------------------------------------------------------------%
142-
143133
%-patch fillcolor-%
144134
fill = extractPatchFace(patch_data);
145135

@@ -149,8 +139,6 @@
149139
obj.data{patchIndex}.surfacecolor = fill.color;
150140
end
151141

152-
%-----------------------------------------------------------------%
153-
154142
%-surfaceaxis-%
155143
if strcmp(obj.data{patchIndex}.type,'scatter3d')
156144
minstd = min([std(patch_data.XData) std(patch_data.YData) std(patch_data.ZData)]);

plotly/plotlyfig_aux/handlegraphics/updateScatterhistogram.m

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,19 +367,6 @@ function updateYMarginalAxis(obj, plotIndex)
367367
end
368368
end
369369

370-
function lineDash = getLineDash(lineStyle)
371-
switch lineStyle
372-
case '-'
373-
lineDash = 'solid';
374-
case '--'
375-
lineDash = 'dash';
376-
case ':'
377-
lineDash = 'dot';
378-
case '-.'
379-
lineDash = 'dashdot';
380-
end
381-
end
382-
383370
function axisLim = getAxisLim(plotData, axName)
384371
axisLim = plotData.(axName + "Limits");
385372
axisPlot = plotData.(axName + "Data");

plotly/plotlyfig_aux/handlegraphics/updateSpiderPlot.m

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,14 @@
100100
end
101101

102102
function lineStruct = getLine(plotData, traceIndex)
103-
%-INITIALIZATIONS-%
104-
lineStruct = struct();
105-
106-
%-line color-%
107103
[lineColor, ~] = getColor(plotData.Color, traceIndex, ...
108104
plotData.LineTransparency);
109-
lineStruct.color = lineColor;
110-
111-
%-line width-%
112-
lineStruct.width = plotData.LineWidth(traceIndex);
113-
114-
%-line style-%
115-
switch plotData.LineStyle{traceIndex, 1}
116-
case '-'
117-
lineStyle = 'solid';
118-
case '--'
119-
lineStyle = 'dash';
120-
case ':'
121-
lineStyle = 'dot';
122-
case '-.'
123-
lineStyle = 'dashdot';
124-
end
125105

126-
lineStruct.dash = lineStyle;
106+
lineStruct = struct( ...
107+
"color", lineColor, ...
108+
"width", plotData.LineWidth(traceIndex), ...
109+
"dash", getLineDash(plotData.LineStyle{traceIndex, 1}) ...
110+
);
127111
end
128112

129113
function markerStruct = getMarker(plotData, traceIndex)

0 commit comments

Comments
 (0)