how to remove repeated Xtick values

2 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2015 年 5 月 5 日
コメント済み: Elysi Cochin 2015 年 5 月 5 日
i wanted to plot a graph with values as below
x= [1/24, 1/20, 1/16, 1/8, 1/4, 1/3];
y = [71,84,93,97,100,100];
i wanted the Xticklabel values for x to come as
Xt = {'1/24', '1/20', '1/16', '1/8', '1/4', '1/3'};
but i get repeated values of Xticklabel, it is not coming correctly... please can someone help me... the code i wrote is below...
x = 1 : 6;
y = [71,84,93,97,100,100];
figure(1),
plot(x, y, 'rs-', 'LineWidth', 2, 'Color', 'g', 'MarkerFaceColor', 'g');
xlabel('Beta'); ylabel('Average Accuracy'); grid on;
Xt = {'1/24', '1/20', '1/16', '1/8', '1/4', '1/3'};
set(gca, 'XTickLabel', Xt)

採用された回答

Michael Haderlein
Michael Haderlein 2015 年 5 月 5 日
I don't like the idea of labeling x=1 with "1/24" too much, but if you want to do this: You also need to set the xtick property:
set(gca, 'XTickLabel', Xt)
needs to be
set(gca, 'XTickLabel', Xt,'xtick',x)
  1 件のコメント
Elysi Cochin
Elysi Cochin 2015 年 5 月 5 日
thank you sir....

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

その他の回答 (0 件)

カテゴリ

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