フィルターのクリア

How do I customize xticks on plots?

1 回表示 (過去 30 日間)
Hosup Song
Hosup Song 2017 年 3 月 2 日
コメント済み: Hosup Song 2017 年 3 月 2 日
I'm trying to draw a plot and put custom gridlines on it by chaging the xticks.
say if I have x = linspace(0,100,101) and I wish to do plot(x,y = x+2)
I wish to have customize the xticks so that it only shows xticks at 24 and 95, resulting in two gridlines at 24 and 95. My ultimate goal is to do the same with yticks as well so that I have only a total of 2 gridlines on each axis.
I'm using R2015b if that helps.
I tried to find how to customize/format xticks but none have been helpful so far...

採用された回答

dpb
dpb 2017 年 3 月 2 日
x = linspace(0,100,101);
y=x+2;
plot(x,y)
xt=[24 95]; % set the desired tick location values
set(gca,'xtick',xt,'ytick',xt+2)
grid on
  1 件のコメント
Hosup Song
Hosup Song 2017 年 3 月 2 日
Thanks you saved me

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by