controlling ylable tick of a figure

4 ビュー (過去 30 日間)
Niki
Niki 2014 年 3 月 8 日
コメント済み: Niki 2014 年 3 月 9 日
Hi,
M y label tick is like
2 2.2 2.4 2.8 3 3.2 3.4 3.6
I want not to show the labels of 2 ,2.2 and 2.4 but in my figure show the rest. does anyone know how to do it ? I found a way to do it manually but I want to know how to do it in another way

採用された回答

the cyclist
the cyclist 2014 年 3 月 8 日
編集済み: the cyclist 2014 年 3 月 8 日
This sounds like it does what you want. It is also fairly "manual", but what you want is pretty specific, so maybe that can't be avoided.
If you have a more general rule, like "I only want ticks greater than 3", then that could be put to use. However, you don't give enough detail to guess what you want.
y = [2 2.2 2.4 2.8 3 3.2 3.4 3.6];
x = y./2;
figure
plot(x,y,'.-')
set(gca,'YTick',[2.8:0.2:3.6],'YTickLabel',[2.8:0.2:3.6])
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 8 日
Why not just
set(gca,'YTick',[2.8:0.2:3.6])
Niki
Niki 2014 年 3 月 9 日
you are right azzi , this works

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by