how to customize a colorbar?

4 ビュー (過去 30 日間)
Razvan
Razvan 2013 年 4 月 3 日
Hi,
I try to plot a colorbar next to a plot but to show a color corresponding to the value of the function at that position instead of the range of the colors/values. So I want a layout similar to this:
plot(smooth(rand(1,100), 10));
colorbar('location','southoutside')
But with colors changind according to the value of the function. Any hints?
Thanks

採用された回答

Razvan
Razvan 2013 年 4 月 3 日
Nevermind...
I wanted something like the following (and I figured out that imagesc can help)
f = smooth(rand(1,100), 10);
figure
subplot(5,1,1:4)
plot(f);
subplot(5,1,5)
imagesc(f')
set(gca, 'xtick', [], 'ytick', [])

その他の回答 (1 件)

Doug Hull
Doug Hull 2013 年 4 月 3 日
Colorbar should not have any bearing on a line plot. Maybe you mean the 'colororder' property of the axes:
>> get(gca, 'colororder')
ans =
0 0 1.0000
0 0.5000 0
1.0000 0 0
0 0.7500 0.7500
0.7500 0 0.7500
0.7500 0.7500 0
0.2500 0.2500 0.2500
  1 件のコメント
Razvan
Razvan 2013 年 4 月 3 日
編集済み: Razvan 2013 年 4 月 3 日
Thanks, but I needed something else. I found how to do it meanwhile (see my other answer bellow).
I like your short video tutorials, by the way :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by