How to add hat in the plot legend?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a plot where I have to show the legend in the following way:

However, I have already made the plot and there is already a legend in the plot. I can not run the plot code again beacuse I have many plots to recreate. Is there any way that I can chang the legend within the plot itself by using propery inspector, plot browser, etc so that I don't need to run the code again. The legend is already is tex form.
0 commentaires
Réponses (1)
Star Strider
le 4 Mai 2024
Perhaps this —
x = (0:10);
y = rand(11,2);
figure
plot(x, y(:,1), '-g', 'DisplayName','$i_a^{true}$', 'LineWidth',2)
hold on
plot(x, y(:,2), '--b', 'DisplayName','$i_a\ for\ \widehat{r_l}=1.0$', 'LineWidth',2)
hold off
legend('Location','best', 'Interpreter','LaTeX', 'FontSize',14)
For the hat, you can use either \hat to give
or \widehat
to give the result as showin in the legend. (They actually look different in the legend, although not in the previous sentence.)
.
0 commentaires
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
