Plot won't show line

2 vues (au cours des 30 derniers jours)
Loraine Luceñara
Loraine Luceñara le 25 Juil 2019
Réponse apportée : Vinod le 25 Juil 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');

Réponse acceptée

Vinod
Vinod le 25 Juil 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.

Plus de réponses (0)

Communautés

Plus de réponses dans  ThingSpeak Community

Catégories

En savoir plus sur Visualize Data dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by