【问题标题】:Hide Chart axes but show labels in Matlab隐藏图表轴但在 Matlab 中显示标签
【发布时间】:2016-06-01 18:48:09
【问题描述】:

我想在 Matlab 中隐藏完整的轴形成一个图形。 但是,我确实想显示 xlabel。

这是一个在 Matlab 2015a 中有效的解决方法:

colormap(gray);
imagesc(-prog(:,:,fig));
xlabel(sprintf('c = %.2f',C(:,:,loop(fig))),'color','k')
axis equal; axis tight;
set(gca,'XTick',[],'YTick',[],'XTicklabel',[],...
        'YTicklabel',[],'xcolor','w','ycolor','w') 

但是,自 2015b 和 2016a 以来,这不再起作用,xlabels 不再显示为白色(而不是黑色)

【问题讨论】:

  • 感谢 Suever,stackexchange 的新手;

标签: matlab matlab-figure


【解决方案1】:

您需要更改xlabel 的颜色您更改坐标轴的XColor 否则set(gca, 'XColor', 'w') 会强制所有内容为白色,无论您之前将其设置为什么。

figure(1)
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
imagesc(C)

% Change axes colors and appearance
axis equal; axis tight;
set(gca,'XTick',[],'YTick',[],'XTicklabel',[],...
    'YTicklabel',[],'xcolor','w','ycolor','w') 

% NOW create your black xlabel
xlabel(sprintf('c = test'),'color','k')

【讨论】:

    猜你喜欢
    • 2020-01-09
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多