Why are title and label not working on histogram?
20 次查看(过去 30 天)
显示 更早的评论
belowaveragestudent
2022-5-5
评论: belowaveragestudent
2022-5-5
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 个评论
采纳的回答
Constantino Carlos Reyes-Aldasoro
2022-5-5
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!