How to change x and y labels limts
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a problem with my plot axes labels. I want to have my own range on x-axis and y-axis. On the y - 0:200 and the interval 20. On the x (time mm:ss) - 00:00 : 20:00 and the interval 2 minutes.
a=['00:00';
'00:42';
'00:49';
'00:56';
'02:00';
'02:24';
'02:52';
'03:23';
'04:22';
'05:52';
'06:41';
'08:40';
'09:18';
'10:27';
'11:01';
'11:14';
'11:31';
'11:49';
'12:04']
b=[27.6;
32.1;
37.9;
41.1;
68;
79.6;
89.7;
92.5;
93.4;
93.4;
93.7;
100.3;
109.8;
135.8;
151.1;
160.4;
167.5;
174.6;
179.7]
c=datenum(a, 'MM:SS');
plot(c,b,"-o");
xlabel("Czas [min:sec]")
ylabel("Temperatura [%%cC]")
hold on;
datetick('x','MM:SS')
3 件のコメント
dpb
2020 年 3 月 15 日
How did you learn to use datenum? Read the doc first and give it a go...much faster than waiting on us.
採用された回答
その他の回答 (2 件)
dpb
2020 年 3 月 15 日
編集済み: dpb
2020 年 3 月 15 日
"When I put duration i got error. When I use xtick, the label didnt; fit to reality. "
Must not have tried very hard or read the doc at all... :(
d=duration(cellstr(a),'InputFormat','hh:mm','Format','hh:mm');
plot(d,b)
xlim([hours(0) hours(14)])
ylim([0 200])
xticks(hours(0:2:14))
grid on
produces:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!