From 8548c870eb15486c7ea3fae915842dd1ee768dc2 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 15:17:14 +0000 Subject: [PATCH 1/6] CI: test MATLAB R2021a through R2024a too --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e78271e9..c2bc58a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - release: [R2025a, R2026a] + release: [R2021a, R2022a, R2023a, R2024a, R2025a, R2026a] steps: - name: Checkout uses: actions/checkout@v4 From 4bd951105fdc6def9519ee19cd846f34e684306c Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 16:49:24 +0000 Subject: [PATCH 2/6] updateHeatmap: clamp the color index with min/max (clip needs R2024a) --- plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m b/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m index 69e517c6..133bffb7 100644 --- a/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m +++ b/plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m @@ -77,7 +77,7 @@ col = [255 255 255]; if isfinite(cdata(j,i)) ratio = (cdata(j,i) - data.zmin) / (data.zmax - data.zmin); - colorIndex = 1 + clip(round(ratio*len), 0, len); + colorIndex = 1 + min(max(round(ratio*len), 0), len); c = 255*cmap(colorIndex,:); luminance = [0.299 0.587 0.114] * c'; % ITU-R BT.601 luminance standard if luminance > 128 From 208cf8a75a44e4b945f96c08d5dc30dfbf7d3199 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 16:52:32 +0000 Subject: [PATCH 3/6] updateConstantLine: fall back to the line color before R2024b (no LabelColor) --- plotly/Test_plotlyfig.m | 1 + plotly/plotlyfig_aux/core/updateConstantLine.m | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plotly/Test_plotlyfig.m b/plotly/Test_plotlyfig.m index d91c6e19..4f3f4c06 100644 --- a/plotly/Test_plotlyfig.m +++ b/plotly/Test_plotlyfig.m @@ -1610,6 +1610,7 @@ function testVerticalConstantLineWithLabel(tc) )); tc.verifyTrue(any(cellfun(@(ann) contains(ann.text,label), p.layout.annotations))); tc.verifyTrue(any(cellfun(@(ann) ann.xanchor == alignment, p.layout.annotations))); + tc.verifyTrue(any(cellfun(@(ann) strcmp(ann.font.color, 'rgb(255,0,0)'), p.layout.annotations))); try close(); catch; end end diff --git a/plotly/plotlyfig_aux/core/updateConstantLine.m b/plotly/plotlyfig_aux/core/updateConstantLine.m index 15af3335..5558d46c 100644 --- a/plotly/plotlyfig_aux/core/updateConstantLine.m +++ b/plotly/plotlyfig_aux/core/updateConstantLine.m @@ -59,7 +59,13 @@ annotation.y = get(plotData, 'Value'); end - col = round(255*get(plotData, 'LabelColor')); + % LabelColor only exists since R2024b; its default ('auto' mode) + % is the line color, so older releases fall back to that + if isprop(plotData, 'LabelColor') + col = round(255*get(plotData, 'LabelColor')); + else + col = round(255*get(plotData, 'Color')); + end annotation.font.color = getStringColor(col); annotation.font.family = matlab2plotlyfont(get(plotData, 'FontName')); From 41daa5859eb0a55054af3ed557686636d4ac82e3 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 16:56:03 +0000 Subject: [PATCH 4/6] Test_plotlyfig: skip testPlotTableDataTip before R2022a --- plotly/Test_plotlyfig.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plotly/Test_plotlyfig.m b/plotly/Test_plotlyfig.m index 4f3f4c06..e8979d55 100644 --- a/plotly/Test_plotlyfig.m +++ b/plotly/Test_plotlyfig.m @@ -3041,6 +3041,9 @@ function testPlotTableDataTip(tc) if is_octave() return % DataTipTemplate is not yet implemented in Octave. end + if isMATLABReleaseOlderThan("R2022a") + return % plot(tbl, ...) needs R2022a. + end tb = table(); tb.time = (2:2:12)'; tb.Saved = rand(6,1); From 8c8adcb5deec004a06f1a9250ce8c6ae2eddbff8 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 17:08:09 +0000 Subject: [PATCH 5/6] Test_plotlyfig: build the stackedplot table with classic name-value syntax --- plotly/Test_plotlyfig.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/Test_plotlyfig.m b/plotly/Test_plotlyfig.m index e8979d55..87cc1bcf 100644 --- a/plotly/Test_plotlyfig.m +++ b/plotly/Test_plotlyfig.m @@ -1641,7 +1641,7 @@ function testStackedPlotData(tc) a = cos(x); b = exp(x); dt = datetime(2010,1,1) + years(x); - tb = table(dt',a',b',VariableNames=["date" "a" "b"]); + tb = table(dt',a',b','VariableNames',{'date','a','b'}); stackedplot(tb); p = plotlyfig(fig,"visible","off"); From 8c1f93680461d816614f1bcfc552ed2c7d850d52 Mon Sep 17 00:00:00 2001 From: Roberto Moura Date: Sat, 28 Nov 2026 17:10:27 +0000 Subject: [PATCH 6/6] Test_plotlyfig: take fcontour's expected levels from the figure --- plotly/Test_plotlyfig.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plotly/Test_plotlyfig.m b/plotly/Test_plotlyfig.m index 87cc1bcf..fe885ca1 100644 --- a/plotly/Test_plotlyfig.m +++ b/plotly/Test_plotlyfig.m @@ -1101,13 +1101,16 @@ function testFunctionContourPlotData(tc) return % The `fcontour` function is not yet implemented in Octave. end fig = figure("Visible","off"); - fcontour(@(x,y) sin(3*x).*cos(x+y),[0 3 0 3],Fill="on",LineColor="k"); + fc = fcontour(@(x,y) sin(3*x).*cos(x+y),[0 3 0 3],Fill="on",LineColor="k"); chartTitle = "f(x,y) = sin(3*x)*cos(x+y)"; title(chartTitle); colormap("spring"); p = plotlyfig(fig,"visible","off"); + % the levels fcontour picks differ between releases + levels = fc.LevelList; + clim = get(fc.Parent, 'CLim'); tc.verifyNumElements(p.data, 1); tc.verifyEqual(rmfield(p.data{1}, ["colorscale" "x" "y" "z"]), struct( ... "xaxis", "x1", ... @@ -1119,14 +1122,14 @@ function testFunctionContourPlotData(tc) "ytype", "array", ... "autocontour", false, ... "contours", struct( ... - "end", 0.8, ... - "start", -1, ... - "size", 0.2, ... + "end", levels(end), ... + "start", levels(1), ... + "size", mean(diff(levels)), ... "coloring", "fill" ... ), ... "zauto", false, ... - "zmin", -1, ... - "zmax", 0.8, ... + "zmin", clim(1), ... + "zmax", clim(2), ... "showscale", false, ... "reversescale", false, ... "line", struct( ...