Changing where divisions appear on a Matlab plot

6 ビュー (過去 30 日間)
Aleem Andrew
Aleem Andrew 2020 年 4 月 6 日
コメント済み: Aleem Andrew 2020 年 4 月 6 日
The following code generates a plot in which the scale divisions appear at the edges of the plot but they do not coincide with the axes because the axes are in the middle of the plot. Does anyone have suggestions as to how I can modify the code so they divisions coincide with the axes?
x=linspace(0,10,100000000);
y = 4*(1-exp(-0.001*x/(1.05*10^-4)));
z = 0;
plot(x,y)
yline(0,'-');
xline(0,'-');
xlim([-25 25])
ylim([-20 20])
set(gca,'xtick',-25:1:25, 'XTickLabel', {})
set(gca,'ytick',-20:1:20, 'YTickLabel', {})

採用された回答

dpb
dpb 2020 年 4 月 6 日
編集済み: dpb 2020 年 4 月 6 日
hAx=gca;
hAx.YAxisLocation='origin';
hAx.XAxisLocation='origin';
A little overkill on the number of x,y points isn't it...
  1 件のコメント
Aleem Andrew
Aleem Andrew 2020 年 4 月 6 日
Thank you for your answer

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

その他の回答 (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