I am holding onto a scatter plot and adding data to it through a for loop. For each data set, I would like to label it in the legend but I am running into some problems.
Mostra commenti meno recenti
Below is the line of code I am using. As you can see I am running a for loop where each time it adds a different data set to a scatter plot (this part is working beautifully), but I can't seem to figure out how to change the display name for each data added--obviously this doesn't work and I feel like the j would be useful, but as my comment suggests, it hasn't been so far.
for j=1:height(Fe4plsr),
figure(1)
hold on
B=table2array(A4plsr(j, 2:209));
scatter(A, B, "DisplayName", "Fe")
%cant add j outside of "" to know which, cant add j inside "" because it wouldn't change
xlabel('Wavelengths(nm)')
ylabel('Frequency')
A4corr(j, :)= [B];
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Scatter Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
