Skip to content

Commit 7007414

Browse files
Fix general axis labels
1 parent 6401625 commit 7007414

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

plotly/Test_plotlyfig.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,13 +2131,17 @@ function testAxisLabelSizeFont(tc)
21312131

21322132
p = plotlyfig(fig,"visible","off");
21332133

2134-
tc.verifyEqual(p.layout.xaxis1.title, 'X Label');
2134+
tc.verifyEqual(p.layout.xaxis1.title, struct( ...
2135+
text = "X Label" ...
2136+
));
21352137
tc.verifyEqual(p.layout.xaxis1.titlefont, struct( ...
21362138
color = "rgb(0,0,255)", ...
21372139
size = 20, ...
21382140
family = "Droid Sans, sans-serif" ...
21392141
));
2140-
tc.verifyEqual(p.layout.yaxis1.title, 'Y Label');
2142+
tc.verifyEqual(p.layout.yaxis1.title, struct( ...
2143+
text = "Y Label" ...
2144+
));
21412145
tc.verifyEqual(p.layout.yaxis1.titlefont, struct( ...
21422146
color = "rgb(255,0,0)", ...
21432147
size = 20, ...

plotly/plotlyfig_aux/helpers/extractAxisData.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@
161161
label.FontUnits = "points";
162162

163163
if ~isempty(labelData.String)
164-
axis.title = parseString(labelData.String,labelData.Interpreter);
164+
axis.title = struct( ...
165+
"text", parseString(labelData.String,labelData.Interpreter) ...
166+
);
165167
end
166168

167169
axis.titlefont.color = getStringColor(round(255*labelData.Color));

plotly/plotlyfig_aux/helpers/parseString.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
formatStr = inputStr;
3030

3131
if isempty(inputStr)
32-
formatStr = 'untitled';
32+
formatStr = "untitled";
3333
return
3434
end
3535

@@ -229,4 +229,5 @@
229229
end
230230
end
231231
end
232+
formatStr = string(formatStr);
232233
end

0 commit comments

Comments
 (0)