Plotting N days values in N Y axes

1 view (last 30 days)
Yahav Biran
Yahav Biran on 3 Aug 2015
Commented: Yahav Biran on 3 Aug 2015
I wish to show how solar station power output are similar on daily basis. Assuming we have a table with two rows, date (and time) and the output in MW. I wish to be able to plot several Y axes, where each Y axis is 24 hours only. e.g. the data below will yield two Y axes (2015-01-01 and 2015-01-02) on the same X axis.
2015-01-01 00:00,0.0 2015-01-01 00:05,0.0 ... 2015-01-01 05:05,1.0 ... 2015-01-01 12:05,34.0 ... 2015-01-01 18:05,30.0 ... 2015-01-01 20:05,5.0 ...
2015-01-02 00:00,0.0 2015-01-02 00:05,0.0 ... 2015-01-02 05:05,2.0 ... 2015-01-02 12:05,29.0 ... 2015-01-02 18:05,28.0 ... 2015-01-02 20:05,4.0 ...

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 3 Aug 2015
If you want multiple plot in one axis use hold on
doc hold
  1 Comment
Yahav Biran
Yahav Biran on 3 Aug 2015
Thanks Azzi! In order to use `hold on` I need to partition the file signals into hourly ticks. Assuming I have an import file_sun function (I used the import tool to generate). I created four static days partitions (I have a measurement every 5 min hence the 288): x1 = importfile_sun('sun.csv', 2, 288); x2 = importfile_sun('sun.csv', 289, 577); x3 = importfile_sun('sun.csv', 579, 867); x4 = importfile_sun('sun.csv', 868, 1156);
then I removed the dates part and left only with the time in a day: x1.LocalTime=datetime(x1.LocalTime,'InputFormat','HH:mm'); x2.LocalTime=datetime(x2.LocalTime,'InputFormat','HH:mm'); x3.LocalTime=datetime(x3.LocalTime,'InputFormat','HH:mm'); x4.LocalTime=datetime(x4.LocalTime,'InputFormat','HH:mm'); Finally I plot it with hold on as you suggested: plot(x1.LocalTime,x1.PowerMW); hold on; plot(x2.LocalTime,x2.PowerMW); hold on plot(x3.LocalTime,x3.PowerMW); hold on plot(x4.LocalTime,x4.PowerMW);
But it does not plotting x1,x2,x3,x4 on the same time series 00:00-24:00 but plot them one after each other.
I guess `datetime(x1.LocalTime,'InputFormat','HH:mm'); ` does not remove the date part.
1. Is there any smarter way to partition the file based on line numbers i.e. 288 measurement s per day? 2. How can one plot the three xs in a way that they will share the same X range 00:00-24:00?
Thanks so much!

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!