How to represent multiple lines (20+) in legend?

hi I want to represent data with plot having 24 lines. but when I add the description of each line in the legend, the legend box crosses even the plot frame itself. For better visualization, what should I do. Kindly help me I will be highly thankful to you.
with best regards mudasir

 Réponse acceptée

KL
KL le 10 Sep 2017

0 votes

5 commentaires

Dear KL
Thank you, sir, for your kind help. But sir again I am facing one problem which is
legend_str{ii} = num2str(ii)
in this command, numbers are converted into strings and saved in 'legend_str{ii}'. But sir in my case I have to write theta1 theta2.. in symbolic form as shown in attach picture. How I do this sir.
When you add your legend, specify your interpreter as tex. For example,
legend_str{ii} = ['\theta_' num2str(ii)];
%%other commands
legend(legend_str,'location','NorthWest', 'interpreter', 'tex')
Dear Sir KL
I did the same coding as guided by your kind self. now I am facing another issue which is, after theta 9, the numbering style is not aligned as shown in the attached picture. from theta 10 to theta 24. how to align it sir. Please help me sir
That's simple, use
legend_str{ii} = ['\theta_{' num2str(ii) '}'];
Dear sir KL,
Thank you so much. Now It is perfectly working.
best regards Mudasir

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by