Skip to content

Commit bd9d2ac

Browse files
Add testFigureBackgroundColors (paper_bgcolor and plot_bgcolor extracted from original figure)
1 parent 8f39bc7 commit bd9d2ac

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

plotly/Test_plotlyfig.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,5 +3342,21 @@ function testInvisibleEmptyAxesSkipped(tc)
33423342
tc.verifyEqual(p.data{1}.x, 1:5);
33433343
try close(); catch; end
33443344
end
3345+
3346+
function testFigureBackgroundColors(tc)
3347+
% the native figure and axes background colors must be
3348+
% preserved as paper_bgcolor and plot_bgcolor.
3349+
fig = figure("Visible","off");
3350+
set(fig, "Color", [0.8 0.1 0.1]);
3351+
ax = axes();
3352+
plot(1:5, 1:5);
3353+
set(ax, "Color", [0.1 0.8 0.1]);
3354+
3355+
p = plotlyfig(fig,"visible","off");
3356+
3357+
tc.verifyEqual(p.layout.paper_bgcolor, "rgb(204,26,26)");
3358+
tc.verifyEqual(p.layout.plot_bgcolor, "rgb(26,204,26)");
3359+
try close(); catch; end
3360+
end
33453361
end
33463362
end

0 commit comments

Comments
 (0)