How to fill in o marker with color
6 views (last 30 days)
Show older comments
I am trying to fill in my 'o' markers. Please help.
clc;
clear;
close all;
% Curve Fit - Left of Target
x = [1500 1600 1750 1930 2250];
y = [0 0.25 0.5 0.75 1];
theFit=fit(x' , y', 'exp2','Lower',[0 0 -inf -inf],'Upper',[inf 0 0 0 ])
plot(theFit , x , y)
% Curve Fit - Right of Target
x = [2250 2435 2625 2810 3000];
y = [1 0.75 0.5 0.25 0];
theFit=fit(x' , y', 'A*x+b')
plot(theFit , x , y)
% Interior Square Footage
sqftL = [1500 1600 1750 1930 2250];
sqftR = [2250 2435 2625 2810 3000];
sqftUtilityL = [0 0.25 0.5 0.75 1];
sqftUtilityR = [1 0.75 0.5 0.25 0];
% Plot Utility Points
figure;
plot(sqftL,sqftUtilityL,'o',sqftR,sqftUtilityR,'o');
xlim([1500 3000]);ylim([0 1.25]);
yticks([sqftUtilityL 1.25]);
grid on;
xlabel('Interior Square Footage (ft^2)');
ylabel('Utility');
legend('Utility Left of Target Value','Utility Right of Target Value');
% Utility curve fittings
a = 1.279;
b = 0;
c = -26.3;
d = -0.00202;
curveX_left = linspace(1500,2250);
curveY_left = a*exp(b*curveX_left) + c*exp(d*curveX_left);
hold on;
plot(curveX_left,curveY_left,'Color','b');
p1 = -0.001333;
p2 = 3.999;
curveX_right = linspace(2250,3000);
curveY_right = p1*curveX_right + p2;
hold on;
plot(curveX_right,curveY_right,'Color','r');
legend('Utility Left of Target Value','Utility Right of Target Valye',...
'Left Curve Fitting','Right Curve Fitting');
% Consistency Checks
sqftLCheck = 2000;
sqftLUtilityCheck = 0.875;
sqftRCheck = 2340;
sqftRUtilityCheck = 0.875;
plot(sqftLCheck,sqftLUtilityCheck,'*','Color','c');
plot(sqftRCheck,sqftRUtilityCheck,'*','Color','m');
legend('Utility Left of Target Value','Utility Right of Target Value',...
'Left Curve Fitting','Right Curve Fitting','Left Consistency Check',...
'Right Consistency Check');
0 Comments
Answers (1)
the cyclist
on 11 Nov 2023
Set the MarkerFaceColor property:
clc;
clear;
close all;
% Curve Fit - Left of Target
x = [1500 1600 1750 1930 2250];
y = [0 0.25 0.5 0.75 1];
theFit=fit(x' , y', 'exp2','Lower',[0 0 -inf -inf],'Upper',[inf 0 0 0 ])
plot(theFit , x , y)
% Curve Fit - Right of Target
x = [2250 2435 2625 2810 3000];
y = [1 0.75 0.5 0.25 0];
theFit=fit(x' , y', 'A*x+b')
plot(theFit , x , y)
% Interior Square Footage
sqftL = [1500 1600 1750 1930 2250];
sqftR = [2250 2435 2625 2810 3000];
sqftUtilityL = [0 0.25 0.5 0.75 1];
sqftUtilityR = [1 0.75 0.5 0.25 0];
% Plot Utility Points
figure;
h = plot(sqftL,sqftUtilityL,'o',sqftR,sqftUtilityR,'o');
set(h(1),'MarkerFaceColor','b')
set(h(2),'MarkerFaceColor','r')
xlim([1500 3000]);ylim([0 1.25]);
yticks([sqftUtilityL 1.25]);
grid on;
xlabel('Interior Square Footage (ft^2)');
ylabel('Utility');
legend('Utility Left of Target Value','Utility Right of Target Value');
% Utility curve fittings
a = 1.279;
b = 0;
c = -26.3;
d = -0.00202;
curveX_left = linspace(1500,2250);
curveY_left = a*exp(b*curveX_left) + c*exp(d*curveX_left);
hold on;
plot(curveX_left,curveY_left,'Color','b');
p1 = -0.001333;
p2 = 3.999;
curveX_right = linspace(2250,3000);
curveY_right = p1*curveX_right + p2;
hold on;
plot(curveX_right,curveY_right,'Color','r');
legend('Utility Left of Target Value','Utility Right of Target Valye',...
'Left Curve Fitting','Right Curve Fitting');
% Consistency Checks
sqftLCheck = 2000;
sqftLUtilityCheck = 0.875;
sqftRCheck = 2340;
sqftRUtilityCheck = 0.875;
plot(sqftLCheck,sqftLUtilityCheck,'*','Color','c');
plot(sqftRCheck,sqftRUtilityCheck,'*','Color','m');
legend('Utility Left of Target Value','Utility Right of Target Value',...
'Left Curve Fitting','Right Curve Fitting','Left Consistency Check',...
'Right Consistency Check');
0 Comments
See Also
Categories
Find more on Interpolation 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!