How to make a heatmap with density of points

121 Ansichten (letzte 30 Tage)
Ángel González
Ángel González am 22 Aug. 2018
Kommentiert: Walter Roberson am 14 Sep. 2020
Hello!
I have two vectors ( x_vector and y_vector) which correspond with the different points obtained on my simulation. The point is that I want to make a kind of heatmap with the density of the repetition of those points. I have tried with different functions such as imagesc or histogram2, but I didn't get to achieve what I wanted.
Thank you.

Akzeptierte Antwort

jonas
jonas am 22 Aug. 2018
Bearbeitet: jonas am 22 Aug. 2018
  14 Kommentare
Ángel González
Ángel González am 30 Aug. 2018
Ahhhhh okey okey, I didn't know that min(C{2}) meant C{2}(1). I supposed that it would return the minimum value of that array.
Thank you!!
jonas
jonas am 30 Aug. 2018
Bearbeitet: jonas am 30 Aug. 2018
Well you were not incorrect, min(C{2}) does not always equal C{2}(1). However, in this specific case C{2}(1) is the minimum value of C{2}. It works both ways.
Sorry for the confusing code ;)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 22 Aug. 2018
  2 Kommentare
Michael King
Michael King am 14 Sep. 2020
Great answer to this question! I'd like to ask a follow up question. Can a number be extracted to indicate the extent of density in a data set? i.e. how focused is a heatmap?
Walter Roberson
Walter Roberson am 14 Sep. 2020
If you use Malcolm's contribution, then his dataDensity() function calculates those numbers.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by