How can I create a plot like this?
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I have a timetable called "Tc1"(attached file) in which, the Column1streamId column contains certain information. I want to create a plot in which in the x axis I put the information of the Column1streamId, in the y axis I put the time (from 12:00 AM to 12:00 AM of the next day). How can I do it?
채택된 답변
jonas
2018년 8월 12일
Kind of looks like a scatter plot. You can try this:
%%Load data
data = load('Tc1.mat');
Tc1=data.Tc1;
t=Tc1.t
%%time of day (y)
y=duration([hour(t) minute(t) second(t)])
%%date (x)
x=datetime(year(t),month(t),day(t))
%%color (z)
[z,groups]=findgroups(Tc1.Column1streamId);
scatter3(x,y,z,[],z)
xtickformat('MMM-dd')
view([0 90])
set(gca,'xtick',unique(x))
Obviously it will look more similar when you have more days.
댓글 수: 11
Erica Corradi
2018년 8월 12일
편집: Erica Corradi
2018년 8월 14일
I tried your code, but I have this error:
Error using scatter3 (line 123) Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can be converted to double.
Error in AAL (line 323) scatter3(x,y,z,[],z)
ps: thanks jonas for your help!
Did you copy paste my code exactly, without adding more data?
What is the class of x, y, z in your workspace?
Erica Corradi
2018년 8월 14일
I copied your code exactly. X is datetime; y is duration and z... I don’t remember because now I haven’t the computer with MatLab.
Same here, im on mobile but will check potential errors tonight
Btw did you test the code in a clean script? Your error message suggests you have implemented it as part of a larger script.
Erica Corradi
2018년 8월 14일
Ok thanks a lots jonas!!!
Erica Corradi
2018년 8월 14일
I tried both situations: in a clear script and in my large script. And both don’t work.
Just to be sure, run this script as is. It should output the figure below. Apparently the error message displays if the x-axis is set to double, which it is if you have already plotted some double on it. Possibly, this could happen if you are trying to plot the scatter3 on an already existing figure. Does an axis appear before the script stops?
What release are you running?

Erica Corradi
2018년 8월 14일
Ok, as soon as I can, I try it. I have the last version of MatLab.
jonas
2018년 8월 14일
Okidoki. We have the same script, the same data and the same release. I don't see how it can not work. Let me know how it goes!
Erica Corradi
2018년 8월 14일
Thanks jonas, it works! Now I'm trying to make it work in my large script, using the Tc table created with the first chart (always made by you).
jonas
2018년 8월 15일
Awesome! Let me know if you run into trouble
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
