着色命令在 MATLAB 和 Octave 中产生不同的结果

Shading command produces different results in MATLAB and Octave

命令 shading facetedshading interp 在 MATLAB 和 Octave 中产生不同的图形。

考虑这段代码:

[X, Y] = meshgrid(0:2, 0:2);
Z = magic(3);

figure;
colormap('jet');

subplot(1, 3 ,1);
imagesc(Z);
axis xy
yticklabels({'0', '1', '2'})
yticks(1:3)
xticklabels({'0', '1', '2'})
xticks(1:3)
title('imagesc(Z)');

subplot(1,3,2);
surf(X, Y, Z);
shading faceted;
view([0,0,1]);
yticks(0:3)
xticks(0:3)
title('surf(X, Y, Z); shading faceted;');

subplot(1,3,3);
surf(X, Y, Z);
shading interp;
view([0,0,1]);
yticks(0:3)
xticks(0:3)
title('surf(X, Y, Z); shading interp;');

这是 MATLAB 中的结果:

而Octave生成的结果:

MATLAB 生成正确的 figure.What 这个 Octave 图有错吗?

我们得到两个不同输出的原因是什么? view 命令有问题吗?

编辑(错误报告后)

Ocatve 6.1 已修复:https://hg.savannah.gnu.org/hgweb/octave/raw-file/11072ea6a16c/scripts/plot/appearance/view.m

您的代码看起来正确。我可以在 macOS 上的 Octave 4.4 和 5.2 中重现。

拨打 xlabel('X Axis'); 电话以澄清发生了什么。

这看起来确实像是 Octave 的 view 实现中的错误。看起来 X 轴和 Y 轴正在交换。您能否将此报告为 https://savannah.gnu.org/bugs/?group=octave 的 Octave 问题跟踪器上的错误?