Effacer les filtres
Effacer les filtres

Inverse y-axis heatmap

33 vues (au cours des 30 derniers jours)
Vipin Veetil
Vipin Veetil le 10 Mar 2019
Commenté : Eric Burdette le 10 Juil 2019
I would like to make a heatmap from tabular data. My code is below. The heatmap has y-axis values descending order, I would like to them in ascending order. However using set(gca..) gives me the following error:The name 'YDir' is not an accessible property for an instance of class 'matlab.graphics.chart.HeatmapChart'.
In the data below, 's' and 'g' are the independent variable headers in the csv file. 'mean' is the dependent variable header.
data = readtable('data.csv')
h = heatmap(data,'s','g', 'ColorVariable', 'mean');
set(gca,'YDir','normal');
  1 commentaire
Eric Burdette
Eric Burdette le 10 Juil 2019
h = heatmap(data,'s','g', 'ColorVariable', 'mean');
h.YDisplayData = flipud(h.YDisplayData); % equivalent to 'YDir', 'Reverse'

Connectez-vous pour commenter.

Réponse acceptée

Astha Singh
Astha Singh le 13 Mar 2019
The error is seen because, there is no property named 'YDir' for the HeatMapChart object obtained in MATLAB.
The complete list of available properties acn be found at the following link:
For ordering the Y-axis labels of the chart you can manually set the values of the property, 'YDisplayData'.
Please refer the second example, 'Reorder Heatmap Labels' at the following link:

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by