Borrar filtros
Borrar filtros

How to add hat in the plot legend?

3 visualizaciones (últimos 30 días)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA el 3 de Mayo de 2024
Respondida: Star Strider el 4 de Mayo de 2024
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.

Respuestas (1)

Star Strider
Star Strider el 4 de Mayo de 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.)
.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by