Effacer les filtres
Effacer les filtres

Renaming data to create legend for figure ploting

4 vues (au cours des 30 derniers jours)
Yat Chi
Yat Chi le 30 Déc 2023
Commenté : Adam Danz le 30 Déc 2023
I designed a code to plot the data into a graph. It goes successfully but how can I rename the line in order according to the column in variable SNR_GNS and legend that into the figure? For example like the line in column 3 is renamed to G3 and line in column 10 is renamed to G10. Thanks
  1 commentaire
Adam Danz
Adam Danz le 30 Déc 2023
Images of code and data are really difficult to work with. Copying the sections of code/data as text makes it much easier to offer help.

Connectez-vous pour commenter.

Réponse acceptée

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 30 Déc 2023
It can be attained using legend() command, e.g.:
A = randi([-5 25], 5, 13);
B = 1:size(A,2);
plot(B,A, '-o', 'linewidth', 2)
xlabel('B')
ylabel('A series')
legend('A_1', 'A_2', 'A_3', 'A_4', 'A_5', 'Location', 'Best')

Plus de réponses (0)

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by