How can I give my fit plot the same color as the data points?

18 views (last 30 days)
Of course, a similar question was asked already here . But it didn't fit for my problem. What I have is:
fig1 = figure(1)
plot(x1,y1,'.','markersize',14, 'markeredgecolor', [0 0 1]);
plot(x1,polyval(fit1,x1,'-'), 'markeredgecolor', [0 0 1]);
But doesn't matter wich color code I type in, Matlab changes the color of the fitplot graph. How can I solve this problem?

Accepted Answer

Ahmet Cecen
Ahmet Cecen on 15 Dec 2016
Not super clear description, a picture would help but:
Are you sure you don't mean to use the 'Color' property instead of 'markeredgecolor' for the second plot?
  1 Comment
jeferia_tue on 15 Dec 2016
oh man.....yes..of course...this was the problem.^^ Thank you.

Sign in to comment.

More Answers (0)


Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by