Writing x values with subscript in the graph

2 次查看(过去 30 天)
Dear all,
I want to writing x values with subscript in the graph as follows:
Here is my code:
data=xlsread('boxplot');
col_header={'GA_{343}','GA351','GA352','GA342','GA153','GA353','GA141','GA273','GA143','GA373'};
data=data';
boxplot(data,col_header)
xlabel('Algorithm')
ylabel('Fitness Value')
How can I do this. Also, I use MATLAB 2020a version.
Thanks.

采纳的回答

dpb
dpb 2021-3-27
hAx=gca; % save the axes handle -- may want later
hAx.TickLabelInterpreter='tex'; % set tick label interpreter
Then your first column label will show the subscript; the answer for the rest is then apparent...
See the section on 'interpreter' optional named parameter at
doc text
for the details of TeX interpreter syntax.
  6 个评论
Abdullah Türk
Abdullah Türk 2021-3-28
I tried this
col_header={'GA_{343}','GA_{351}','GA_{352}','GA_{342}','GA_{153}','GA_{353}','GA_{141}','GA_{273}','GA_{143}','GA_{373}'};
and it works. Thank you so much again my friend :)
dpb
dpb 2021-3-28
Told ya'! :)
Glad to help; as noted earlier, the syntax rules for TeX are documented under text for future reference when want to get fancy again... :) Otherwise, it's kinda' hard to find in the doc if don't know/remember that.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by