How to convert long to scientific e format in plots legend?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
txt = ['lambda = ',num2str(lambda(check))];
plot(1:100, abs(Arec(:,2000)),'DisplayName',txt)% capon
legend show
How to change the long format to scieitific e, like 1e6 in legend?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1027315/image.jpeg)
0 Commenti
Risposte (1)
Bjorn Gustavsson
il 10 Giu 2022
You could be a bit more explicit in the call to legend:
txt = ['lambda = ',num2str(lambda(check))];
ph = plot(1:100, abs(Arec(:,2000))); % ,'DisplayName',txt); % capon
leg_str = sprintf('lambda = %3.3g',lambda(check));
legend(ph,leg_str)
HTH
2 Commenti
Bjorn Gustavsson
il 10 Giu 2022
True, but explicitly calling legend with the plot-handles has additional benefits in terms of what to include, which is not necessary in this case but will eventually pop up.
Vedere anche
Categorie
Scopri di più su Legend in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!