Effacer les filtres
Effacer les filtres

I made a Heat map. I want to remove the x and y axis ticks. How is that possible?

28 vues (au cours des 30 derniers jours)
Sattik Basu
Sattik Basu le 8 Sep 2017
Modifié(e) : Walter Roberson le 22 Août 2023
I tried using set(gca............), but that is for plot. i am stuck at this.
  2 commentaires
Walter Roberson
Walter Roberson le 8 Sep 2017
Is this the heatmap from the Bioinformations toolbox? https://www.mathworks.com/help/bioinfo/ref/heatmap.html
Or is it the new (R2017a) heatmap() that is for table objects?
Sattik Basu
Sattik Basu le 9 Sep 2017
It is the new (R2017a) heatmap().

Connectez-vous pour commenter.

Réponses (3)

Walter Roberson
Walter Roberson le 9 Sep 2017
There are no x and y axis ticks for the new R2017a heatmap object. There is at most the ticks inside the colorbar beside the drawing. Is it the colorbar tick marks that you want to remove?
  10 commentaires
Image Analyst
Image Analyst le 10 Sep 2017
Imshow has an 'InitialMagnification' setting.
FWDekker
FWDekker le 10 Avr 2020
Modifié(e) : FWDekker le 10 Avr 2020
Thanks, Walter! Just a quick note: Calling xlabel or ylabel after doing this may bring back the ticks. Took me a while to figure out why your snippet didn't seem to be working.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 8 Sep 2017
How about
axis off;
  1 commentaire
Sattik Basu
Sattik Basu le 8 Sep 2017
i tried this too. but i am getting the following error.
Error using axis (line 63) Using axis with heatmap is not supported.

Connectez-vous pour commenter.


Jesús Bernardino Velázquez Fernández
Modifié(e) : Walter Roberson le 22 Août 2023
h=heatmap(x,y,c);
s=struct(h);
s.XAxis.Visible='off';
s.YAxis.Visible='off';
  2 commentaires
Walter Roberson
Walter Roberson le 22 Août 2023
Demonstration:
load patients
tbl = table(LastName,Age,Gender,SelfAssessedHealthStatus,...
Smoker,Weight,Location);
h = heatmap(tbl,'Smoker','SelfAssessedHealthStatus');
s=struct(h);
Warning: Calling STRUCT on an object prevents the object from hiding its implementation details and should thus be avoided. Use DISP or DISPLAY to see the visible public details of an object. See 'help struct' for more information.
s.XAxis.Visible='off';
s.YAxis.Visible='off';
Walter Roberson
Walter Roberson le 22 Août 2023
Modifié(e) : Walter Roberson le 22 Août 2023
Note this removes the x and y axes labels as well as the ticks.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by