Threshold to set colour for different scale range in Heatmap

As of R2019b, There is no in-built function to set the colour of different scaled range in heatmap. Perhaps, this function can faciliate you

https://github.com/KevinChngJY/heatmapthresholdmatlab

Vous suivez désormais cette soumission

How to use this function?
The function name is generatecolormapthreshold, first argument is the threshold and second argument is the colour

color= generatecolormapthreshold([1 10 25 30],[0 0.5 1; 0 1 0;1 0 0]);
h = heatmap(fluS,'DayName','noofweek','ColorVariable','Max_Data','Colormap',color,'ColorLimits',[1 30]);
h.FontSize=10;
h.Title='Heatmap';

means that range 1-25 is the colour for [0 1 1], 25-30 is the colour [1 0 0].

Citation pour cette source

Kevin Chng (2026). Threshold to set colour for different scale range in Heatmap (https://github.com/KevinChngJY/heatmapthresholdmatlab), GitHub. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux

Les versions qui utilisent la branche GitHub par défaut ne peuvent pas être téléchargées

Version Publié le Notes de version Action
1.0.0

Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.
Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.