How to rotate XtickLabels and make them vertical.

8 ビュー (過去 30 日間)
dipak sanap
dipak sanap 2015 年 12 月 29 日
コメント済み: Walter Roberson 2018 年 10 月 19 日
f = fopen('1IV7_1M.txt','r');
x = fscanf(f , '%d %d %f' , [3 inf]);
x = x';
g = fopen('1FA3_6_1M.txt','r');
y = fscanf(g, '%d %d %f %f',[4 inf]);
y = y';
h = fopen('1FA3_12_1M.txt','r');
z = fscanf(h, '%d %d %f %f', [4 inf]);
z = z';
F = [x(:,3), y(:,3), z(:,3)];
Fmean = mean(F,2);
Fsd = std(F,0,2);
Ferr = Fsd/sqrt(3);
errorbar(Fmean, Ferr, 'bx');
xlabel ('H-bonded amide residue pairs ');
ylabel ('F (pN)');
label = cellstr(num2str(x(:,1:2)));
title('Average force on backbone atoms due to all atoms of its parntering H-bond residue ');
set(gca,'XTickLabel',label);
set(gca,'XTick',1:length(label))

採用された回答

Walter Roberson
Walter Roberson 2015 年 12 月 29 日
The method of rotating tick labels depends upon which MATLAB you are using. If you are using R2014b or later then see http://www.mathworks.com/help/matlab/ref/axes-properties.html#property_xticklabelrotation

その他の回答 (3 件)

Mariana Frid Dalarsson
Mariana Frid Dalarsson 2018 年 10 月 16 日
Try this: xtickangle(45)
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 10 月 19 日
This will work from R2016b onwards, but would not have worked for Ahmed Lachhab's R2013a version.

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


Laura
Laura 2015 年 12 月 29 日
  1 件のコメント
dipak sanap
dipak sanap 2015 年 12 月 29 日
yes, something like that i did and it worked :)

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


Ahmed Lachhab
Ahmed Lachhab 2018 年 8 月 18 日
my x axis labels are long (dates), I have a 2013a version, how can I tilt them by 45 deg. thank you
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 8 月 22 日
The File Exchange Contribution linked to above should work for you.

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

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by