Plot colors not showing up in Matlab R2020a Student Version

6 views (last 30 days)
Hi everyone! I have a problem. In my scatter plot, the legend show the correct color code for each plot category but in the graph, the colour are all the same. I have tried to change the colour code in my command but it seems to follow my last colour codes in the command. This is my command>>
figure
hold on
grid on
scatter(x(w1),y(w1),'y','filled')
scatter(x(w2),y(w2),'m','filled')
scatter(x(w3),y(w3),'c','filled')
scatter(x(w4),y(w4),'r','filled')
scatter(x(w5),y(w5),'g','filled')
scatter(x(w6),y(w6),'b','filled')
scatter(x(w7),y(w7),'k','filled')
xlabel('Expected Departure Time (hrs, mins)')
ylabel('Delayed Time (hrs, mins)')
legend('Delay>60mins','Delay 31mins to 60mins)','Delay 16mins to 30mins','Delay 5mins to 15mins','On Time','Earlier 5mins to 15mins','Earlier>15mins')
hold off

Answers (1)

Steven Lord
Steven Lord on 9 Jun 2020
Are all the earlier points plotted over by points in the last category? Look at the figure after each scatter call to see if this is the case.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!