How do I make a 1D continuous heatmap?
古いコメントを表示

I am trying to make 1D-continuous heatmap for my data, something like the image on the top. My data range is between 0-1 and has random values between the limits. However, when I try to plot it, it gives me intensities of the individual values as separate boxes. I do not what this. I want my data to be automatically scaled to plot values between 0-1, with recurring numbers (such as 0.9) showing a dark color and less frequent numbers with a lighter tone.
In summary, what I am trying to do it have my data be represented in form of an intensity gradient.
I am currently using the following code:
n = [data]
heatmap (n,'colorscaling','scaled','colorlimits',[0 1])
caxis([0,1])

Any help will be appreciated!
回答 (1 件)
Akira Agata
2018 年 2 月 5 日
How about using imagesc function? The following is an example.
data = rand(1,100); % sample data
map = interp1([0;1],[1 1 1;0 0.45 0.74],0:0.01:1); % color map
imagesc(data)
colormap(map)
colorbar

1 件のコメント
Omer Mujahid
2021 年 4 月 12 日
Imagesc does not improve much on the heatmap.
カテゴリ
ヘルプ センター および File Exchange で Color and Styling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!