How to change x and y labels limts
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Damian Konaszewski
le 15 Mar 2020
Modifié(e) : dpb
le 15 Mar 2020
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 commentaires
dpb
le 15 Mar 2020
How did you learn to use datenum? Read the doc first and give it a go...much faster than waiting on us.
Réponse acceptée
Plus de réponses (2)
dpb
le 15 Mar 2020
Modifié(e) : dpb
le 15 Mar 2020
"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 commentaires
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!