modifying the legend for multiple plots
2 次查看(过去 30 天)
显示 更早的评论
i am trying to plot som data that is divided into bins according to a time interval of 3 hours. i.e the first plot represent the data from 0:00am to 3:00 am and so on .
I would like to have the legend on each plot to display the interval of time that we are plotting. i.e instead of having 1,2,3.. displayed on each legend representing the bin number, we want to have the time interval of each bin ex: 0:00am- 3:00am, 3:00am - 6:00am and so on. how may we do that?
I attach a sample of how the plots looks like and the code I am using to generate them.
0 个评论
采纳的回答
Sulaymon Eshkabilov
2021-11-6
You should introduce a new cell variable with legend names as you specified, e.g.:
TimeInterval = [{'0:00am- 3:00am'}, {'3:00am- 6:00am'}, {'6:00am- 9:00am'}, {'9:00am- 12:00pm'},...
{'12:00pm- 3:00pm'}, {'3:00am- 6:00pm'}];
uBin=unique(t1.Bin);
for i=uBin(:).'
nexttile
isBin=(t1.Bin==i);
scatter(t1.NE8(isBin),t1.GDALT(isBin),'.')
legend("Bin "+ TimeInterval{i}, 'Location','best')
xlabel('NE, units'),ylabel('GDALT, ft')
box on
xlim([0 3E12]);
ylim([100 2000]);
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!