Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: plotyy axis auto
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
RICARDO

Posts: 5
Registered: 12/6/12
plotyy axis auto
Posted: Oct 17, 2013 8:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I plotted two sets of data y with the same x. I would like to make the axis auto in order to get a tight plot.
Here is my code:

clc;clear all;%close all;
fconversion = 10^6*0.000621371;
% read labels and x-y data
[soot,tTMAT,tPAX,extTMT,extPAX,eSca]=textread('041713','%d %s %s %f %f %f');
[t_vis_airport,vis_airport]=textread('air_041713','%s %f');
t_tm = datenum(datevec(tTMAT,'HH:MM'));
t_tceq0319 = datenum(datevec(t_vis_airport,'HH:MM'));
visTMT = zeros(size(extTMT));
visTMT = (3.912*fconversion./extTMT')';
fig = figure;
set(fig,'units','normalized','outerposition',[0 0 1 1]);
[ax,H1,H2]=plotyy(t_tm,visTMT,t_tm,vis_airport,'plot');
for i=1:2
datetick(ax(i),'x', 15) % look up datetick in help to get more info on the 2nd argument
% axis auto;
end
set(get(ax(1),'Ylabel'),'String','Model (mi)');
set(get(ax(2),'Ylabel'),'String','Airport (mi)');
xlabel('Local time');
title({'April 17, 2013'});

%%%%%%%%%%%%%%%%%%%
end of matlab code
%%%%%%%%%%%%%%%%%%%
"file 041713"

4 13:27 13:27 179.23801 179.28810 0.05009
2 15:12 15:12 314.89700 315.15451 0.25751
2 15:27 15:27 303.63199 303.60461 0.02737
4 16:42 16:42 421.10101 421.03381 0.06720
2 16:57 16:57 309.84399 310.53610 0.69211
1 17:27 17:27 314.35501 315.49200 1.13699
3 17:42 17:42 358.78900 359.10019 0.31119
3 17:57 17:57 342.25699 342.71390 0.45691
0 18:57 18:57 329.47000 330.55490 1.08490
6 19:42 19:42 403.23801 402.08551 1.15250

"file air_041713"

13:27 1.25
15:12 1.25
15:27 1.15
16:42 2.48
16:57 2.50
17:27 2.50
17:42 2.50
17:57 2.50
18:57 2.60
19:42 3.70

If you plot my code you will see what I am talking about.
Thanks for your time.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.