Plot won't show line
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Loraine Luceñara
am 25 Jul. 2019
Beantwortet: Vinod
am 25 Jul. 2019
I've been trying to plot a chart on thingspeak. but the line won't seem to appear. How do I make the line appear?
I've tried to change the line to a dashed line, I've also tried to varying the linewidth but all it got me were much bigger markers. I've checked and all the arrays right size. If it helps, the timestamps array is a datetime array.
Here is all of my code:
% Channel ID to read data from
readChannelID = 827912;
% Temperature Field ID
TemperatureFieldID = 1;
% Wind speed Field ID
HumidityFieldID = 4;
% Channel Read API Key
% If your channel is private, then enter the read API
% Key between the '' below:
readAPIKey = 'CZD7YSPVMXAAI188';
% Read Data. Learn more about the thingSpeakRead function by
% going to the Documentation tab on the right side pane of this page.
[data, timeStamps] = thingSpeakRead(readChannelID, 'Fields',[TemperatureFieldID HumidityFieldID], ...
'NumPoints', 300, ...
'ReadKey', readAPIKey);
% Extract the temperature data from the first column
temperatureData = data(:, 1);
% Extract the windspeed data from the second column
HumidityData = data(:, 2);
% Visualize Data
yyaxis left
plot(timeStamps, temperatureData,'mo-',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',5);
ylabel('Temperature');
hold on;
yyaxis right
plot(timeStamps, HumidityData, '--mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','b',...
'MarkerSize',5);
ylabel('Humdity');
0 Kommentare
Akzeptierte Antwort
Vinod
am 25 Jul. 2019
My guess is that your data has a bunch of NaN's in it which is causing the issue.
Look at the documentation of the rmmissing and fillmissing functions in MATLAB as a way to remove or fill the missing points before plotting.
0 Kommentare
Weitere Antworten (0)
Communitys
Weitere Antworten in ThingSpeak Community
Siehe auch
Kategorien
Mehr zu Visualize Data finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!