Im trying to make a basic scatter plot from some data that I have collected but my code is producing inconsistent results. I'm only getting 9/10 points to plot for 2017/2018 and the legend is inaccurate for 2017. I dont understand why this is happening because i literally copy and pasted the plot commands and then just changed correspomding year numbers.
clear all; close all;pd19 = [3650];pd18 = [3494];pd17 = [2713];chr19 = [2480];chr18 = [2479];mat17 = [2470];cai19 = [2365];cai18 = [2958];cai17 = [2881];ev19 = [2955];ev18 = [2688];ev17 = [2631];jen19 = [2862];jen18 = [2871];jen17 = [2345];nad19 = [2546];nad18 = [2423];nad17 = [2410];sch19 = [2771];sch18 = [2996];sch17 = [2631];jam19 = [2307];jam18 = [2546];jam17 = [2226];sea19 = [2915];sea18 = [3494];bla17 = [2402];mar19 = [2603];mar18 = [2683];mar17 = [2500];x19 = [2019];x18 = [2018];x17 = [2017];figure(1)hold onscatter(x19,pd19, 'd', 'filled')scatter(x19, ev19,'d', 'filled')scatter(x19, chr19,'filled')scatter(x19, cai19,'d', 'filled')scatter(x19, mar19, 'filled')scatter(x19, jen19, 'd', 'filled')scatter(x19, sea19, 'filled')scatter(x19, sch19, 'm','d', 'filled')scatter(x19, jam19, 'filled')scatter(x19, nad19, 'filled')xlim([2016 2020])ylim([2200 3700])title('League scoring over time')ylabel('Points For')xlabel('Year')grid onlegend('pd', 'evan','chris/matt','caitlyn','mark','jenna','sean/blazic','schiesl','james','nadav')scatter(x18,pd18, 'd', 'filled')scatter(x18, ev18,'d', 'filled')scatter(x18, chr18, 'filled')scatter(x18, cai18,'d', 'filled')scatter(x18, mar18, 'filled')scatter(x18, jen18,'d', 'filled')scatter(x18, sea18, 'filled')scatter(x18, sch18,'m','d', 'filled')scatter(x18, jam18, 'filled')scatter(x18, nad18, 'filled')legend('pd', 'evan','chris/matt','caitlyn','mark','jenna','sean/blazic','schiesl','james','nadav')scatter(x17,pd17, 'd', 'filled')scatter(x17, ev17,'d', 'filled')scatter(x17, mat17, 'filled')scatter(x17, cai17,'d', 'filled')scatter(x17, mar17, 'filled')scatter(x17, jen17,'d', 'filled')scatter(x17, bla17, 'filled')scatter(x17, sch17,'m','d', 'filled')scatter(x17, jam17, 'filled')scatter(x17, nad17, 'filled')legend('pd', 'evan','chris/matt','caitlyn','mark','jenna','sean/blazic','schiesl','james','nadav')hold off
Best Answer