Plots in Matlab using Latex interpreter
64 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ameer Ahmed
el 17 de Jun. de 2018
Comentada: Walter Roberson
el 26 de Oct. de 2021
Hi
I want to insert a bar over a parameter in xlabel of plot for representing it as an average value. I have used Latex interpreter for this using command:
xlabel('Average throughput $\it{\bar{T}} \rm{(files/slot)}$','interpreter','latex');
set(get(gca,'XLabel'),'Fontname','Times new roman','FontSize',14);
When i excute the command, it doesn't change the font type to Times new roman rather a different font is displayed. Only the font size changes. I think the problem is with \bar{T}. I have changed to Tex and removed $ signs as well then it shows the same text as shown in xlabel.
I will be oblidged if someone could give me suggestion.
0 comentarios
Respuesta aceptada
Walter Roberson
el 17 de Jun. de 2018
When you use $$ then that is Math mode, which uses a different font by default. To control the font inside Math mode, you need to embed font commands. See https://www.mathworks.com/matlabcentral/answers/321122-how-to-change-the-fontname-of-axes-labels-when-using-the-latex-interpreter#answer_251215
2 comentarios
Tony Castillo
el 26 de Oct. de 2021
Dear Walter,
I got a similar issue but my code, does not give me an error or anything else. I have found the interpreter function for making more appealling the text which I am introducing to my pie chart, but it is not working properly.
Can you help me with any workaround to overcome the issue highlithed in the figure that I have shared.
I look forward to hearing from you
Best regards
x=[Gas, Petrol, PV_siliceLCA];
explode=[0 1 0];
p=pie(x, explode);
pText = findobj(p,'Type','text');
percentValues = get(pText,'String');
txt = {'Gas_m^3: ';'Petrol_Lts: '; 'PV_W·h: '};
combinedtxt = strcat(txt,percentValues);
pText(1).String = combinedtxt(1);
pText(2).String = combinedtxt(2);
pText(3).String = combinedtxt(3);
Walter Roberson
el 26 de Oct. de 2021
txt = {'Gas m^3: ';'Petrol Lts: '; 'PV W·h: '};
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Support en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!