From b29bfc736977e5f901bf917f2c31071dafe068c0 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 21 Nov 2026 14:33:48 +0000 Subject: [PATCH 1/2] updateFigure: size the plotly figure like the MATLAB figure --- plotly/plotlyfig.m | 1 - plotly/plotlyfig_aux/core/updateFigure.m | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plotly/plotlyfig.m b/plotly/plotlyfig.m index e3b8cdcf..e86dd392 100644 --- a/plotly/plotlyfig.m +++ b/plotly/plotlyfig.m @@ -86,7 +86,6 @@ "MinTitleMargin", 10, ... "TitleHeight", 0.01, ... "TitleFontSizeIncrease", 40, ... - "FigureIncreaseFactor", 1.5, ... "AxisLineIncreaseFactor", 1.5, ... "MarginPad", 0, ... "MaxTickLength", 20, ... diff --git a/plotly/plotlyfig_aux/core/updateFigure.m b/plotly/plotlyfig_aux/core/updateFigure.m index ffdc252d..274d215b 100644 --- a/plotly/plotlyfig_aux/core/updateFigure.m +++ b/plotly/plotlyfig_aux/core/updateFigure.m @@ -61,8 +61,8 @@ h = figurePosition(4); end - obj.layout.width = w * obj.PlotlyDefaults.FigureIncreaseFactor; - obj.layout.height = h * obj.PlotlyDefaults.FigureIncreaseFactor; + obj.layout.width = w; + obj.layout.height = h; col = round(255*obj.State.Figure.OriginalColor); obj.layout.paper_bgcolor = getStringColor(col); From 5e0a732e0a170d39b8d141889337b58dec0f98d7 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 21 Nov 2026 14:35:34 +0000 Subject: [PATCH 2/2] Test_plotlyfig: add testFigureSizeLayout --- plotly/Test_plotlyfig.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plotly/Test_plotlyfig.m b/plotly/Test_plotlyfig.m index 4e839c8f..d91c6e19 100644 --- a/plotly/Test_plotlyfig.m +++ b/plotly/Test_plotlyfig.m @@ -51,6 +51,18 @@ function testLinePlotDatetimeXaxis(tc) try close(); catch; end end + function testFigureSizeLayout(tc) + fig = figure("Visible","off","Units","pixels","Position",[100 100 500 300]); + plot(1:3); + + p = plotlyfig(fig,"visible","off"); + + figurePosition = get(fig, "Position"); + tc.verifyEqual(p.layout.width, figurePosition(3)); + tc.verifyEqual(p.layout.height, figurePosition(4)); + try close(); catch; end + end + function testLinePlotLayout(tc) fig = figure("Visible","off"); y = [0.0301 0.4411 0.7007 0.7030 0.5102 0.6122 0.7464 0.8014 0.3367 0.5641];