Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions plotly/Test_plotlyfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -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", ...
Expand All @@ -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( ...
Expand Down Expand Up @@ -1610,6 +1613,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

Expand Down Expand Up @@ -1640,7 +1644,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");
Expand Down Expand Up @@ -3040,6 +3044,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);
Expand Down
8 changes: 7 additions & 1 deletion plotly/plotlyfig_aux/core/updateConstantLine.m
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion plotly/plotlyfig_aux/handlegraphics/updateHeatmap.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading