How can I change a single line color and style in a graph?
Show older comments
Hi! I have created a code that will generate 3 figures, with 8 lines in each figure.
I want to change the color and style of the lines individually, but can't seem to find a way that works. Any advice would be really helpful!
The code is shown here.
phistep = 0.0001;
phiarr = (0.25:phistep:5)';
numberofvalues = (5-0.25)/phistep+1;
d11 = 65493;
d12 = 1267;
d22 = 32243;
d66 = 1867;
marr = [1,2,3,4];
narr = [1,2];
for c = [0,1,2]
linevalues = zeros(numberofvalues,length(marr)*length(narr));
for m = marr
for n = narr
for i = 1:numberofvalues
phi = phiarr(i);
idx = (m-1)*(length(narr))+n;
linevalues(i,idx) = ((pi^2)/(100^2))*(d11*(m/phi)^4 + 2*(d12+2*d66)*(m*n/phi)^2 + d22*n^4)/((m/phi)^2+c*n^2);
end
end
end
figure(c+1)
phimat = repmat(phiarr,1,length(marr)*length(narr));
[y_min, idx]=min(linevalues);
x_min = phimat(idx);
plot(phimat,linevalues,x_min,y_min,'rx');
ylim([0 600]);
xlabel('aspect ratio');
ylabel('buckling load');
grid on
legend('m=1,n=1','m=1,n=2','m=2,n=1','m=2,n=2','m=3,n=1','m=3,n=2','m=4,n=1','m=4,n=2')
end
Accepted Answer
More Answers (0)
Categories
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!