【问题标题】:Matlab: is it possible to rotate the colorbar of a figure?Matlab:是否可以旋转图形的颜色条?
【发布时间】:2016-06-08 21:44:40
【问题描述】:

我生成了这张图片

figure(1)
set(gca,'FontSize',14,'FontName','Arial');
h = pcolor(yq,xq, tmpI);
set(h, 'EdgeColor', 'none');
axbot = gca;  
colorbar('FontSize',14,'FontName','Arial');
xlabel('\it{\beta_F}', 'FontSize', 15, 'FontName', FontNM);
ylabel('\it{R_0}', 'FontSize', 15,'FontName', FontNM);
colormap(bluewhitered1);
colormap(flipud(colormap))

我想知道是否有办法旋转颜色条并有类似的东西?

【问题讨论】:

    标签: matlab plot figure colorbar


    【解决方案1】:

    来自colorbar documentation 有一个example 正在做你所要求的:

    figure
    surf(peaks)
    colorbar('Direction','reverse')
    

    Benoit_11 cmets 在 2013a 上的命令是 colorbar('YDir','reverse')

    【讨论】:

    • 好收获。虽然我认为这是针对最新版本的 MATLAB;在 2013a 上我需要使用 colorbar('YDir','reverse')
    • 使用 Direction 它返回 Unknown property 'Direction' 而你的最后一个建议并没有改变任何东西,我不知道为什么
    • @emax 这很奇怪:上面的代码在 MATLAB 2014b 上对我有用。您可以输入c = colorbar,然后点击Show all properties 或拨打fields(c) 看看是否有明显的选项
    • 我用h = colorbar;set( h, 'YDir', 'reverse','FontSize',14,'FontName','Arial' );解决了这个问题
    猜你喜欢
    • 2011-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-01
    • 2018-04-04
    • 2018-10-28
    • 2015-02-03
    相关资源
    最近更新 更多