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

57 visualizzazioni (ultimi 30 giorni)
I tried using set(gca............), but that is for plot. i am stuck at this.

Risposte (3)

Walter Roberson
Walter Roberson il 9 Set 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 Commenti
FWDekker
FWDekker il 10 Apr 2020
Modificato: FWDekker il 10 Apr 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.

Accedi per commentare.


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

Accedi per commentare.


Jesús Bernardino Velázquez Fernández
Modificato: Walter Roberson il 22 Ago 2023
h=heatmap(x,y,c);
s=struct(h);
s.XAxis.Visible='off';
s.YAxis.Visible='off';
  2 Commenti
Walter Roberson
Walter Roberson il 22 Ago 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 il 22 Ago 2023
Modificato: Walter Roberson il 22 Ago 2023
Note this removes the x and y axes labels as well as the ticks.

Accedi per commentare.

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by