Hello- I have three samples of sensors data that I wish to plot on the same graph. Both data columns use the same x values (5 minutes interval from 00:00 to 23:55). Assuming the data was imported:
sun = importfile_sun3('sun.csv', 2, 289);
sun.LocalTime=datetime(sun.LocalTime,'InputFormat','MM/dd/yy HH:mm');
sun=sortrows(sun,'LocalTime');
x=sun.LocalTime;
y1=sun.PowerMW;
y2=sun.PowerMW1;
y3=sun.PowerMW2;
when I use plotyy it plots only two, I am looking for something that can accommodate three or more dimensions. I found the two links below from another thread but the link is not available for sometime plotyyy
Any help will be appreciated.
Thank you,
--Yahav

 Accepted Answer

dpb
dpb on 17 Aug 2015
Edited: dpb on 17 Aug 2015
You don't show the pertinent issue of the plotyy call you use but
hAx=plotyy(x, y1, x, [y2 y3]);
will put the first on the LH axes and the other to on the right. Of course, you don't need the temporary variables at all, either...
hAx=plotyy(sun.LocalTime,sun.PowerMW,[sun.PowerMW1,sun.PowerMW2]);
does the same thing with the original variables. Salt to suit re: "who's on first", etc., etc., as far as which quantities go where, of course...
ERRATUM Dang keyboard! Typed what I wrote instead of what I meant! :( I missed the second 'x' in the variable list, sorry. Corrected above (although I see you did find it, too).

3 Comments

Yahav Biran
Yahav Biran on 17 Aug 2015
Edited: Yahav Biran on 17 Aug 2015
Thank you for your answer! let me explain the issue I have with plotyy: If I use
figure; hAx=plotyy(x,y1,x,y2);
it plots the first and the second column.
If I use:
hAx=plotyy(x,y1,[y2 y3]);
it complains: Error using plotyy (line 36) Not enough input arguments. Error in untitled7 (line 10) hAx=plotyy(x,y1,[y2 y3]); Also with to comma
Error using plotyy (line 36) Not enough input arguments.
Error in untitled7 (line 10) hAx=plotyy(x,y1,[y2,y3]);
Also, plotyy indicate nothing about the nested form plotyy(x,y1,[y2 y3])
Thank you!
Just found it: hAx=plotyy(x,y1,[x,x],[y2,y3]);
THANKS!
dpb
dpb on 17 Aug 2015
Yeah, I just had noticed it but you had already worked thru my typo...good job!

Sign in to comment.

More Answers (0)

Categories

Tags

Asked:

on 17 Aug 2015

Commented:

dpb
on 17 Aug 2015

Community Treasure Hunt

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

Start Hunting!