Since you are new, let us show you how Trendy works.

Close-button

MLB Longest Streaks

This plot is disabled.

Who's had the most consecutive wins or losses?

Plot Image
d = data1690;
t = time1690;

dd = double(diff(flipud(d))<=0);
streaks = sum(cumprod(dd) .* dd);
m = max(streaks);
winnerIndexList = find(m==streaks);

dd = double(diff(flipud(d))>=0);
streaks = sum(cumprod(dd) .* dd);
m = max(streaks);
loserIndexList = find(m==streaks);

indexList = [winnerIndexList loserIndexList];

names = { ...
'Angels', ...
'Astros', ...
'Athletics', ...
'Blue Jays', ...
'Braves', ...
'Brewers', ...
'Cardinals', ...
'Cubs', ...
'Diamondbacks', ...
'Dodgers', ...
'Giants', ...
'Indians', ...
'Mariners', ...
'Marlins', ...
'Mets', ...
'Nationals', ...
'Orioles', ...
'Padres', ...
'Phillies', ...
'Pirates', ...
'Rangers', ...
'Rays', ...
'Red Sox', ...
'Reds', ...
'Rockies', ...
'Royals', ...
'Tigers', ...
'Twins', ...
'White Sox', ...
'Yankees'};

plot(t,d,'Color',0.8*[1 1 1]);
hold on
plot(t,d(:,indexList), ...
  'LineWidth',2, ...
  'Marker','.', ...
  'MarkerSize',15)
for i = indexList
  text(t(end),d(end,i),['  ' names{i}]);
end
hold off

datetick
ylabel('Win Ratio (out of 1000)')
box off
Tags:

Add Tags


0 comments