plot numbers with gap

this is the code have a gap between the numbers i want perfect graph
clc
clear
close all;
T=[1.96E-5, 2.18E-5, 6.09E-4, 6.04E-4, 6.11E-4];
S=[1.94E-5, 1.96E-5, 1.98E-5, 2.06E-5, 1.49E-4];
X=[1.94E-5, 1.96E-5, 1.97E-5, 2.02E-5, 2.10E-5];
u=400000:400000:2000000;
ax= subplot(1,1,1);
plot(u(1:5),T(1:5),'-o b', 'LineWidth',1.5,'MarkerSize',6)
hold on
plot(u(1:5),S(1:5),'-.o r','LineWidth',1.5,'MarkerSize',6)
plot(u(1:5),X(1:5),'-o m','LineWidth',1.5,'MarkerSize',6)
grid on
legend('v=10','v=20','v=40')
xlabel('Messages arrival rate(Messages/s)')
ylabel('Mean responce time(s)')

2 件のコメント

dpb
dpb 2022 年 6 月 20 日
What would be your working definition of a "perfect" graph, pray tell?
What's wrong with this one, specifically...
Nourah
Nourah 2022 年 6 月 20 日
I want all the numbers to appear in the y axes. I dont want this straight line without any change

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

回答 (1 件)

VBBV
VBBV 2022 年 6 月 20 日
編集済み: VBBV 2022 年 6 月 21 日

0 投票

clc
clear
close all;
T=[1.96E-5, 2.18E-5, 6.09E-4, 6.04E-4, 6.11E-4];
S=[1.94E-5, 1.96E-5, 1.98E-5, 2.06E-5, 1.49E-4];
X=[1.94E-5, 1.96E-5, 1.97E-5, 2.02E-5, 2.10E-5];
u=400000:400000:2000000;
ax= subplot(1,1,1);
plot(u(1:5),T(1:5),'-o b', 'LineWidth',1.5,'MarkerSize',6)
hold on
plot(u(1:5),S(1:5),'-.o r','LineWidth',1.5,'MarkerSize',6);
ylabel('Mean responce time(s)')
yyaxis right
plot(u(1:5),X(1:5),'-o m','LineWidth',1.5,'MarkerSize',6);
legend('v=10','v=20','v=40');
xlabel('Messages arrival rate(Messages/s)')
ylabel('Mean responce time(s)')

4 件のコメント

Nourah
Nourah 2022 年 6 月 20 日
I want them all in the same graph!
VBBV
VBBV 2022 年 6 月 21 日
you can try with yyaxis as above
Nourah
Nourah 2022 年 6 月 24 日
its also not okay
dpb
dpb 2022 年 6 月 24 日
"Not okay" doesn't tell us much -- your data are what they are -- just because they don't plot attractively as you'd like doesn't give license to just arbitrarily change them so they won't overlap.
If you want each shown separately, then try stackedplot or, even, perhaps waterfall
What, again, SPECIFICALLY, is the issue now?
hS=stackedplot(u.'/1E6,[T;S;X].','-o','DisplayLabels',{'v=10','v=20','v=40'});
provides
You can fixup limits/tick values, grid on/off, linestyle, etc., etc., to your heart's content -- but the data are still the data.

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

カテゴリ

タグ

質問済み:

2022 年 6 月 20 日

コメント済み:

dpb
2022 年 6 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by