How to label graph curves?

10 views (last 30 days)
Nisar Ahmed
Nisar Ahmed on 15 Feb 2021
Commented: Nisar Ahmed on 20 Feb 2021
Hello,
I have attached a figure in which Rpp is plotted at different angles and I want to label each graph with incident angle. say graph first is angle 10 degree etc. How can I add labeling here? The code of figure is copied here.
figure(4),
subplot(1,5,1);
plot(Out(:,1),time);
xlabel('Rpp')
ylabel('Time (ms)')
set(gca, 'ydir', 'reverse');
subplot(1,5,2);
plot(Out(:,10),time);
set(gca, 'ydir', 'reverse');
subplot(1,5,3);
plot(Out(:,20),time);
set(gca, 'ydir', 'reverse');
subplot(1,5,4);
plot(Out(:,30),time);
set(gca, 'ydir', 'reverse');
subplot(1,5,5);
plot(Out(:,40),time);
set(gca, 'ydir', 'reverse');

Accepted Answer

Reshma Nerella
Reshma Nerella on 18 Feb 2021
Hi,
From my understanding, you have multiple subplots and what to label each of them with the incident angle.
After creating subplot, you can add xlabel, ylabel, title for that specific plot and you can do this for all the subplots.
In your case,
You can add title to the each subplot with the incident angle after you create it.
For instance,
subplot(1,5,2);
plot(Out(:,10),time);
set(gca, 'ydir', 'reverse');
title('10 degree incident angle');
subplot(1,5,3);
plot(Out(:,20),time);
set(gca, 'ydir', 'reverse');
title('20 degree incident angle');
For more information and examples, refer to the documentation page of subplot.
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!