Effacer les filtres
Effacer les filtres

How to change name of "Others" category for histogram with 'ShowOthers'

3 vues (au cours des 30 derniers jours)
jpfeifer
jpfeifer le 27 Fév 2019
Modifié(e) : Adam Danz le 27 Fév 2019
When using
hh=histogram(C,'ShowOthers','on');
Matlab will create a category "Others". Is there a way to access this name and change it to something else?

Réponse acceptée

Adam Danz
Adam Danz le 27 Fév 2019
Modifié(e) : Adam Danz le 27 Fév 2019
Access the axis handle from the histrogram handle ('hh'), then use strrep() to replace the 'Others' in the XTickLabel with whatever you want (here I use "Misc."). Then reassign the new XTickLabel to the axis. You can do that all in 1 line.
hh.Parent.XTickLabel = strrep(hh.Parent.XTickLabel, 'Others', 'Misc.')

Plus de réponses (0)

Tags

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by