plot x axis as persentage

2 ビュー (過去 30 日間)
Mustafa Alhandhali
Mustafa Alhandhali 2019 年 4 月 20 日
編集済み: David Wilson 2019 年 4 月 20 日
how i can plot x axis as persentage
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 4 月 20 日
Can you elaborate more?

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

回答 (1 件)

David Wilson
David Wilson 2019 年 4 月 20 日
編集済み: David Wilson 2019 年 4 月 20 日
Below, I've plotted an arbitrary function between arbitrary limits, -5 and +37.
%%
x = linspace(-5,37)';
y = erf(x/20);
subplot(2,1,1);
hp=plot(x,y)
Now you asked for the x-axis to be in percentage. That's a little ambiguous, so I've intrepted that to mean percentage of the lower x-limit to the upper x-limit. (Note: that may not be what your data lies between.) I've used xlim to get those values.
xl = xlim; % lower & upper limits of the x-axis scale above.
xperc = (x-xl(1))/diff(xl)*100 % convert to %
subplot(2,1,2)
plot(xperc, y)
xlabel('x [%]')
See

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by