【问题标题】:decouple colorbar from figure matlab从图形matlab中解耦颜色条
【发布时间】:2015-02-03 15:56:06
【问题描述】:

是否可以在不改变图形颜色的情况下改变colorbar的颜色?

figure_1 = figure;
j1= bar(rand(2,10),'stacked');
colormap(winter)
htx = colorbar('SouthOutside');
colormap(jet)

特别是我想让图中的对象用颜色图冬天和颜色图喷射后的颜色条着色...是否可以将 2 解耦?

【问题讨论】:

标签: matlab colorbar colormap


【解决方案1】:

为此我使用了两个 FileExchange 函数,结果令人满意。 @Benoit_11 在他的评论中给出的链接中提到的freezeColors 将让您在一个图中有两个或多个具有不同颜色图的子图,但颜色条必须很难,freezeColors 忽略它们。为此,您需要COLORMAP and COLORBAR utilities,尤其是cbfreeze,它将修复颜色条并防止其发生变化。

所以你的代码应该是这样的:

figure_1 = figure;
j1= bar(rand(2,10),'stacked');
colormap(winter)
freezeColors;

htx = colorbar('SouthOutside');
colormap(jet)
cbfreeze(htx);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-01
    • 2018-04-04
    • 2018-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-06
    相关资源
    最近更新 更多