how to make a legend for a single point

59 次查看(过去 30 天)
Hi,
I have a problem with making a legend, I have used this code to make a graph:
figure; hold on
for i = 0:0.005:1
C_vm=(1-i)*C_al+i*C_sic; % i stands for the folume fraction
Cm_1212_voigt=C_vm(4,4) % for a isotropic material
plot(i,Cm_1212_voigt,'.','color','green')
end
But when I want to make a legend of this graph made of points, I get a legend of all the points on that line. I just want a legend of a single point. How can i make it happen?

采纳的回答

madhan ravi
madhan ravi 2019-9-17
h=plot(i,Cm_1212_voigt,'.g') % inside loop
legend(h,'Points') % outside loop
  3 个评论
Thomas Roza
Thomas Roza 2019-9-18
it works, but how do i edit multiple different points in a graph? in this case it only prints the last legend and not the first, i would like to have them both in the graph?
%% calculation stiffness matrix Voigt
figure; hold on
for i = 0:0.05:1
C_vm=(1-i)*C_al+i*C_sic; % i stands for the folume fraction
Cm_1212_voigt=C_vm(4,4); % for a isotropic material
%plot(i,Cm_1212_voigt,'.','color','green')
h=plot(i,Cm_1212_voigt,'.g') % inside loop
end
legend(h,'voigt') % outside loop
%% calculation stiffness matrix Reuss
for i = 0:0.05:1
C_rm=inv((1-i)*inv(C_al)+i*inv(C_sic));
Cm_1212_reuss=C_rm(4,4);
r=plot(i,Cm_1212_reuss,'.r')
end
legend(r,'reuss')
madhan ravi
madhan ravi 2019-9-18
You put some random code with missing datas and you ask one question. With a hunch an answer is being given and after a while another comment again with missing datas and then you expect an answer by magic?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by