Use latex with bar command in categorical array

12 ビュー (過去 30 日間)
Kevin Cardenas
Kevin Cardenas 2021 年 7 月 6 日
コメント済み: Kevin Cardenas 2021 年 7 月 6 日
Hi I would like to insert Latex text in the part of this graph that i've underlined instead of the one that is already there. Does anyone know how? Is it possible?
Thanks in advance.
The main code, if necessary, is the following
xx=diag(critAng2);
figure
barX=bar(ca,xx,'stacked');
ylabel("$\theta_c$",'Interpreter','latex','FontSize',12)
hold on
%Teórico
bar(ca,TEO,'FaceColor','none','EdgeColor','k','LineWidth',0.8);
grid on
legend([ERR,"Teórico"],'Location',"northwest")
legend('boxoff')
title("Angulo Crítico",'Interpreter',"latex")

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 7 月 6 日
編集済み: Scott MacKenzie 2021 年 7 月 6 日
This should work:
set(gca,'xtick',x,'XTickLabel',s,'TickLabelInterpreter','latex');
Above, x contains the tick values and s is a cell array containing the tick labels with latex syntax. As an example, with s initialized as follows:
s = {'$\it{Label\ 1}$', '$\pi r^2$', '$\textbf{Label\ 3}$', '$\frac{foo}{bar}dy$'};
the bar chart x-axis tick labels appear thus:
  1 件のコメント
Kevin Cardenas
Kevin Cardenas 2021 年 7 月 6 日
thank you so much! this worked :'D and well in my case I had to use x = b.XData where b stores bar.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by