why the legends are showing same colour if i have 1 than 1 data ? if only 1 data then the legend is showing correctly.
how to assign x as each day of month like 1 to 31st july, i need "x" only as date realtime. not as datetime

 채택된 답변

Scott MacKenzie
Scott MacKenzie 2021년 7월 6일
편집: Scott MacKenzie 2021년 7월 6일

1 개 추천

Change line 3 from
t = datetime;
to
t = linspace(datetime('yesterday'), datetime('tomorrow'), length(InspectionPlan));
For plotting, t needs to be the same size as InspectionPlan. The line above achieves this, but ideally you should probably intialize t so each entry is the date/time of the corresponding entry in InspectionPlan.

댓글 수: 3

% Inspection Demand vs Inspection Executed Trend
InspectionPlan = thingSpeakRead(1421679, 'Fields', 1, 'Numpoints', 100);
t = linspace(datetime('yesterday'), datetime('tomorrow'), length(InspectionPlan));
w1=.5;
hold on
bar(t,InspectionPlan,w1,'FaceColor','r');
InspectionExecuted = thingSpeakRead(1421679, 'Fields', 2, 'Numpoints', 100);
w2=.25;
bar(t,InspectionExecuted,w2,'FaceColor','y');
hold off
grid on
ylabel('Quantity(products)')
legend('InspectionPlan','InspectionExecuted','Location','northwest');
xtickformat('yyyy-MM-dd')
Rizwan Khan
Rizwan Khan 2021년 7월 13일
still the dates does not matching while ploting.
i am ploting field1 vs field2
Rizwan Khan
Rizwan Khan 2021년 7월 13일
Data enetred in 2nd july but plot is showing from 12th july

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

추가 답변 (1개)

Christopher Stapels
Christopher Stapels 2021년 7월 6일

0 개 추천

This looks like an interesteing application. Can you tell us more about what you are monitoring?

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

태그

질문:

2021년 7월 6일

댓글:

2021년 7월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by