How do I make a 1D continuous heatmap?
Ältere Kommentare anzeigen

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!
Antworten (1)
Akira Agata
am 5 Feb. 2018
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 Kommentar
Omer Mujahid
am 12 Apr. 2021
Imagesc does not improve much on the heatmap.
Kategorien
Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!