[英]Matlab xticklabel with fraction and "symbol" fontname
I want to be able to use a proper fraction in the xticklabel
context, using 'fontname',
'symbol'
.我希望能够在xticklabel
上下文中使用适当的分数,使用'fontname',
'symbol'
。 For example :例如 :
plot(1:10,1:10)
set(gca, 'XTick',[pi/2]);
set(gca, 'XTicklabel',{'p/2'},'fontname','symbol');
I want the last xticklabel
to the equivalent to the latex \\frac{\\pi}{2}
.我希望最后一个xticklabel
相当于乳胶\\frac{\\pi}{2}
。
What do you say?你怎么说?
You can set the text interpreter for tick labels to 'latex' and then use your latex string directly:您可以将刻度标签的文本解释器设置为“乳胶”,然后直接使用您的乳胶字符串:
plot(1:10,1:10)
set(gca, 'XTick',[pi/2]);
set(gca,'TickLabelInterpreter','latex')
set(gca, 'XTicklabel',{'$\frac{\pi}{2}$'});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.