Change of marker size and color of a fitted plot
37 views (last 30 days)
Show older comments
Cheuk Yin Wong on 27 May 2022
Commented: Cheuk Yin Wong on 31 May 2022
x = T.Power_W;
y = T.Pressure_MPa;
f = fit(x,y,'power1')
xlabel('Power / W');
ylabel('Pressure / MPa');
legend('Raw data', 'Fitted function')
I have created a plot of some scattered data with a fitted power function. However, I cannot change the marker size by using plot(f,x,y,'MarkerSize',12). It shows 'Error using plot. Invalid color, marker, or line style.'. Could anyone please tell me how to change the color and the size of the marker? Thank you.
dpb on 28 May 2022
The specialized version of plot for use with a fit object doesn't know about all the regular data plot function; it has only a set specific to it. <plot> is the specific version.
You'll have to save the line handles and use them;
2×1 Line array:
Line (fitted curve)
which shows you the first of the two is the data; the second the fitted line/curve which doesn't have any markers set.
will work, but I'm guessing 12 is going to be too large...
More Answers (0)
Find more on Scatter 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!