Reputation: 4855
I would like to plot all columns of a timetable. For example, let's say, I have a timetable with two columns.
time = datetime({'2017-11-15'; '2017-11-18'; '2017-11-19'});
col1 = [NaN;4;5];
col2 = [7;6;4];
tt = timetable(time, col1, col2);
How can I plot all columns (line chart)?
Let me add three things:
Upvotes: 1
Views: 3598
Reputation: 56
It's worth nothing that as of version R2018b, the stackedplot
function makes this a lot easier:
stackedplot(tt)
Upvotes: 1
Reputation: 4855
There's an even less complicated version. :-)
plot(tt.time, tt.Variables);
Upvotes: 3
Reputation: 2187
Take a look at varfun:
>> ax = axes('NextPlot','add');
>> varfun(@(v) plot(ax,tt.time, v), tt)
Upvotes: 1