Remove data labels in a heatmap

66 visualizaciones (últimos 30 días)
Dora Velcsov
Dora Velcsov el 1 de Nov. de 2019
Editada: Md Nazmul Anam el 13 de Dic. de 2023
I am using a heatmap containing a grid of 1000x1000 points. The data values are displayed on the x and y axis, which is too much; they overlap since there are too many. I would like to remove all data and keep only the xlabel, ylable, and title with a larger font size. I am not sure how to change the font size either. I tried several things without luck.
Here is my command where "a" is the 1000x1000 matrix.
heatmap(a,'xlabel','\mu','ylabel','\nu','title',['Frequency of (\mu, \nu) for ','\epsilon = ',num2str(epsilon)]);
Thank you.

Respuesta aceptada

Star Strider
Star Strider el 1 de Nov. de 2019
If you just want to remove them, try this:
hmh = heatmap(a,'xlabel','\mu','ylabel','\nu','title',sprintf('Frequency of (\\mu, \\nu) for \\epsilon = %.2f',epsilon));
Ax = gca;
Ax.XDisplayLabels = nan(size(Ax.XDisplayData));
Ax.YDisplayLabels = nan(size(Ax.YDisplayData));
They don’t appear to have any properties specific to them (such as 'FontSize') that you can change.
  3 comentarios
Star Strider
Star Strider el 1 de Nov. de 2019
As always, my pleasure!
Yogev Hadad
Yogev Hadad el 8 de Jun. de 2023
Sorry for the late answer ( New user, for the benefit of future questioners):
You can use the following parameter:
heatmap(....,'CellLabelColor','none');
Works like a charm...
Godd luck!

Iniciar sesión para comentar.

Más respuestas (3)

Shipra Jain
Shipra Jain el 29 de Abr. de 2020
Hi,
Is there a way to show only some selective labels on Yaxis?
E.g. I have about 120 labels from 1970-2090. I would like only 1970, 1980, 1990....2090 to appear and switch off the other ones. Is that possible?
Thanks in advance.

Deepali Kushwaha
Deepali Kushwaha el 8 de Jun. de 2023
To remove all xlabel, ylabel and tickslabel:
heatmap(arr,'CellLabelColor','none')
In case you want to retain all labels except xticklabel:
heatmap(arr,'XDisplayLabels',NaN*ones(length(arr),1))
  1 comentario
Md Nazmul Anam
Md Nazmul Anam el 13 de Dic. de 2023
Editada: Md Nazmul Anam el 13 de Dic. de 2023
Thanks a lot! This is the only solution out of 10s at least which solved the issue without messing something else in my plot!

Iniciar sesión para comentar.


Pingsheng Ren
Pingsheng Ren el 17 de Dic. de 2020
Ax.CellLabelColor='none';

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by