modifying the legend for multiple plots

1 次查看(过去 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.

采纳的回答

Sulaymon Eshkabilov
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 CenterFile Exchange 中查找有关 Legend 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by