Home computickets How to make colored lines and markers in ezplot function?

How to make colored lines and markers in ezplot function?

Author

Date

Category

Here is the code, but I need colored lines on the graph. How to do it?

explot ('2 * x ^ 3 - 3 * x ^ 2 + 5', [-5 5])
hold on
explot ('x ^ 3 / (x ^ 2-1)', [0 3])
axis tight

Answer 1

The ezplot function returns a Line object that represents the plotted plot. If the Color property of this object is changed, the line color will change:

h1 = ezplot ('2 * x ^ 3 - 3 * x ^ 2 + 5', [-5 5]) ;
h1.Color = 'Green';
hold on
h2 = ezplot ('x ^ 3 / (x ^ 2-1)', [0 3]);
h2.Color = [0.3 0.2 0.5];

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions