plot in matlab with custom colors

1 次查看(过去 30 天)
I have a data set mentioned below
I want to make a custom plot with respect to time showing different activities(starting,moving,stopping) with different colors. an anyone help me please
  2 个评论
Stephen23
Stephen23 2018-5-28
@Girish Kanika: please upload sample data (in a .mat file) by clicking the paperclip button.
"I want to make a custom plot with respect to time "
What kind of plot: a line plot, a scatter plot, a bar plot, ...? Which column contains the time data?
Girish Kanika
Girish Kanika 2018-5-28
编辑:Girish Kanika 2018-5-28
this is my matfile. i want to make line plot. time data is in first column. Can you help me please.

请先登录,再进行评论。

采纳的回答

Ameer Hamza
Ameer Hamza 2018-5-28
编辑:Ameer Hamza 2018-5-28
You can use to plot the required graphs
c2 = splitapply(@(x) {x}, c(2:end,:), findgroups(c(2:end,end)));
titles = {'accX', 'accY', 'accZ', 'Average'};
for ii=1:4
f = figure;
ax = gca;
hold(ax);
title(titles{ii});
for jj=1:length(c2)
plot([c2{jj}{:,1}], [c2{jj}{:,ii+1}], 'DisplayName', c2{jj}{1,end})
end
legend()
end
  7 个评论
Ameer Hamza
Ameer Hamza 2018-5-29
plotAccelerationColouredByActivity(), is not a MATLAB built-in function. This function is part of the Sensor Data Analytics Webinar. In order to use that function, you will need to download and place in MATLAB path.
Girish Kanika
Girish Kanika 2018-5-29
Thankyou So much got it now..
Regards
Girish

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by