Why are title and label not working on histogram?
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
belowaveragestudent
le 5 Mai 2022
Commenté : belowaveragestudent
le 5 Mai 2022
I have two subplots, both containing histograms but I can't add a title or labels to both of them.
Matlab tells me, that the value assigned to "title", "xlabel" and "ylabel" might be unused.
But I do want to use them.
This is my code so far:
subplot(1,2,1);
histogram(measurement1, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title = ('Temperatures @ Top')
xlabel = ('Temperature')
ylabel = ('Probability')
subplot(1,2,2);
histogram(measurement2, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title = ('Temperatures @ Bottom')
xlabel = ('Temperature')
ylabel = ('Probability')
Any help appreciated
0 commentaires
Réponse acceptée
Constantino Carlos Reyes-Aldasoro
le 5 Mai 2022
You are using the commands incorrectly, by writing title = ('Temperatures @ Top') you are creating a new variable called title with the values that you pass, the correct sintax is the following
measurement1 = 100*randn(100,1);
subplot(1,2,1);
histogram(measurement1, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title ('Temperatures @ Top')
xlabel ('Temperature')
ylabel ('Probability')
Hope that solves your problem
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Histograms 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!