Qiita Teams that are logged in
You are not logged in to any team

Community
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@yamori813

# ThingSpeakの積み上げグラフ

More than 1 year has passed since last update.

```% Last week max and min temputure

last = 7 * 4;

day = datetime('now') - last;
disp(day);

% startdaystr = "Sep 22, 2019 00:00:00";
% enddaystr = "Sep 23, 2019 00:00:00";

for c = 1:last

startdaystr = datestr(day,'mmm dd, yyyy 00:00:00');
enddaystr = datestr(day + 1,'mmm dd, yyyy 00:00:00');

a = filloutliers(a,'linear');
[m, n] = max(a);
[x, y] = min(a);

t(c) = day;
if x > 0
vmax(c) = m - x
vmin(c) = x
elseif m > 0
vmax(c) = m
vmin(c) = x
else
vmax(c) = x - m
vmin(c) = m
end
day = day + 1
end

C = vertcat(vmin, vmax);

H = bar(t, C, 'stacked');

ba = H(1);
bb = H(2);
disp(ba);

ba.FaceColor = 'flat';
bb.FaceColor = 'flat';

set(H(1),{'EdgeColor'},{[1 1 1]});
set(H(2),{'EdgeColor'},{[1 1 1]});
for c = 1:last
if vmin(c) > 0
ba.CData(c,:) = [1 1 1];
bb.CData(c,:) = [1 0 1];
elseif vmax(c) < 0
ba.CData(c,:) = [1 1 1];
bb.CData(c,:) = [1 0 1];
else
ba.CData(c,:) = [1 0 1];
bb.CData(c,:) = [1 0 1];
end
end
```

テストケース：最高気温10度最低気温2度

テストケース：最高気温2度最低気温-10度

テストケース：最高気温-2度最低気温-10度

0
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away