# Weekly increase of Android and iPhone subscribers on reddit

• Latest result: Plot created
• Created on: 25 Dec 2012
• Liked: 1 time

```% time1222 and data1222 available for use
% for Number of iPhone subscribers on reddit
%
% Number of Android subscribers on reddit
%   time vector is: time1223
%   data vector is: data1223

t1 = min([time1222;time1223]);
t2 = max([time1222;time1223]);

t_weeks = datenum(2012,1,2:7:600)';
t_weeks = t_weeks(t_weeks>=t1 & t_weeks<=t2);

d_weeks_1222 = nan(size(t_weeks));
d_weeks_1223 = nan(size(t_weeks));
for ii = 1:length(t_weeks)
d_weeks_1222(ii) = data1222(find(time1222<t_weeks(ii), 1, 'last'));
d_weeks_1223(ii) = data1223(find(time1223<t_weeks(ii), 1, 'last'));
end

% filter outliers
ind_anomalies = [32:35 49];
d_weeks_1222(ind_anomalies) = nan;
d_weeks_1223(ind_anomalies) = nan;

% calculate percentage increase
d_weeks_1222 = diff(d_weeks_1222) ./ d_weeks_1222(1:end-1) * 100;
d_weeks_1223 = diff(d_weeks_1223) ./ d_weeks_1223(1:end-1) * 100;
t_weeks = t_weeks(2:end);

t_weeks(isnan(d_weeks_1222)) = [];
d_weeks_1223(isnan(d_weeks_1222)) = [];
d_weeks_1222(isnan(d_weeks_1222)) = [];

% plotting

% plot(t_weeks,d_weeks_1223, 'b-', 'linewidth', 1)
% hold on
% plot(t_weeks,d_weeks_1222, 'r-', 'linewidth', 1)

area(t_weeks,[d_weeks_1223,d_weeks_1222]);

% K = 1;
% bar1=bar(t_weeks,d_weeks_1223, 'FaceColor', 'b', 'EdgeColor', 'b');
% set(bar1,'BarWidth',K);
% hold on;
% bar2=bar(t_weeks,d_weeks_1222, 'FaceColor', 'r', 'EdgeColor', 'r');
% set(bar2,'BarWidth',K/2);

hold off

datetick('x',17)
legend('Android', 'iPhone', 'Location','NorthWest')
ylabel('Increase of subscribers over one week (\%)','fontsize',15)
set(gca,'fontsize', 15)
```
Tags: