필터 지우기
필터 지우기

How to add hat in the plot legend?

조회 수: 3 (최근 30일)
ANANTA BIJOY BHADRA
ANANTA BIJOY BHADRA 2024년 5월 3일
답변: Star Strider 2024년 5월 4일
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.

답변 (1개)

Star Strider
Star Strider 2024년 5월 4일
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.)
.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by