Why is the autocolor green of plot not the same as plotting 'g'?

T
tanisha97 · Sep 2, 2020 · 1.8K views
Question
Why don't plot(x1,y1,x2,y2) and plot(x1,y1,'b',x2,y2,'g') have the same color green line? Can you make them the same color? All the other colors that can be specified as a character seem to produce the same color as the autocolor of plot().
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 24, 2026

I have no idea why, but you can set the colour manually:

plot(x,y,'color',[0 0.5 0])

or, for that matter, use any 1x3 vector to set the RGB colours. Type

 get(gcf,'DefaultAxesColorOrder')

to see the default colour scheme

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!