필터 지우기
필터 지우기

Color Plot in MATLAB

조회 수: 3 (최근 30일)
Tanay Rastogi
Tanay Rastogi 2017년 10월 27일
댓글: Rik 2017년 10월 28일
Hello, I have a table with accelerometer data in [x,y,z] and then each data point is labelled as either [0,1,2]. The table size is: Rows - 497990 & Column - 4 Column heading (xAcc, yAcc, zAcc, label)
I am trying to plot the only x-axis data vs time. But I want to colour the data based upon the label. So if the label is 0, then it should be red, 1 then green and 2 then blue.
Something like in the image shown.

답변 (1개)

Rik
Rik 2017년 10월 27일
convhull could get you most of the way.
  댓글 수: 2
Tanay Rastogi
Tanay Rastogi 2017년 10월 27일
No, the problem remains still the same. The convhull just gives me a convex hull, but still, no means to plot in different colours.
My data is will be plot(t,x) where, t = column vector of time and x = column vector of the sensor reading. But then, I want to colour the portion of the data that belongs to a specific label in y = label for the data that can be either (0,1,2).
Rik
Rik 2017년 10월 28일
If you don't need anything real-time, you can simply use logical indexing to split your data. For each portion of your data you can plot it with a different color. And if you want only a hull, convhull will get you that.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by