想要绘制出如上图所示折线图,首先,先展示代码:
x=0:10:50;
a=[0, 1.80,7.60,17.40,31.20,49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);
grid
b=[0,1.10,4.20,9.30,16.40,25.50];
hold on
plot(x,b,'s-y','MarkerSize',2,'MarkerFaceColor','y','MarkerEdgeColor','y','LineWidth',2);
c=[0,1.10,4.20,9.30,16.40,25.50];
hold on
plot(x,c,'+-b','MarkerSize',1.5,'MarkerFaceColor','b','MarkerEdgeColor','b','LineWidth',1.5);
d=[0,0.20,0.40,0.60,0.80,1.00]
hold on
plot(x,d,'s-k','MarkerSize',2,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',2);
e=[0,0.10,0.20,0.30,0.40,0.50]
hold on
plot(x,e,'s-r','MarkerSize',2,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',2)
xlabel('Number of participant','fontsize',22,'FontWeight','bold','FontName','Times New Roman')
ylabel('Number of transmission x10^3','fontsize',21,'FontWeight','bold','FontName','Times New Roman')
h=legend('LGHW13','HSXL16','CM17','HSL17','Ours',loc = 0)
set(h,'Fontsize',16,'FontWeight','bold','FontName','Times New Roman');
set(gca,'FontSize',20,'LineWid',2);%设置坐标轴字体打下以及网格粗细
'best' : 0, (only implemented for axes legends)(自适应方式)
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
---------------------
原文:https://blog.csdn.net/You_are_my_dream/article/details/53440964
附上论文中两图代码,以供回忆
x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);
grid
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,‘s-y’,‘MarkerSize’,2,‘MarkerFaceColor’,‘y’,‘MarkerEdgeColor’,‘y’,‘LineWidth’,2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,‘±b’,‘MarkerSize’,1.5,‘MarkerFaceColor’,‘b’,‘MarkerEdgeColor’,‘b’,‘LineWidth’,1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00
]
hold on
plot(x,d,‘s-k’,‘MarkerSize’,2,‘MarkerFaceColor’,‘k’,‘MarkerEdgeColor’,‘k’,‘LineWidth’,2);
e=[0,
0.10,
0.20,
0.30,
0.40,
0.50
]
hold on
plot(x,e,‘s-r’,‘MarkerSize’,2,‘MarkerFaceColor’,‘r’,‘MarkerEdgeColor’,‘r’,‘LineWidth’,2)
xlabel(‘Number of participant’,‘fontsize’,22,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
ylabel(‘Number of transmission x10^3’,‘fontsize’,21,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
h=legend(‘LGHW13’,‘HSXL16’,‘CM17’,‘HSL17’,‘Ours’,‘FontSize’,12,loc = 0)
set(h,‘Fontsize’,16,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’);
set(gca,‘FontSize’,20,‘LineWid’,2);%设置坐标轴字体打下以及网格粗细
x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,‘s-g’,‘MarkerSize’,2,‘MarkerFaceColor’,‘g’,‘MarkerEdgeColor’,‘g’,‘LineWidth’,2);
grid on
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,‘s-y’,‘MarkerSize’,2,‘MarkerFaceColor’,‘y’,‘MarkerEdgeColor’,‘y’,‘LineWidth’,2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,‘±b’,‘MarkerSize’,1.5,‘MarkerFaceColor’,‘b’,‘MarkerEdgeColor’,‘b’,‘LineWidth’,1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00]
hold on
plot(x,d,‘s-k’,‘MarkerSize’,2,‘MarkerFaceColor’,‘k’,‘MarkerEdgeColor’,‘k’,‘LineWidth’,2);
e=[0.5
0.055
0.105
0.155
0.205
0.255]
hold on
plot(x,e,‘s-r’,‘MarkerSize’,2,‘MarkerFaceColor’,‘r’,‘MarkerEdgeColor’,‘r’,‘LineWidth’,2)
xlabel(‘Number of participant’,‘fontsize’,22,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
ylabel(‘Number of measurement x10^3’,‘fontsize’,21,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
h=legend(‘LGHW13’,‘HSXL16’,‘CM17’,‘HSL17’,‘Ours’,‘FontSize’,12,loc = 0)
set(h,‘Fontsize’,16,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’);
set(gca,‘FontSize’,20,‘LineWid’,2);
修改后的第二个
x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,‘s-g’,‘MarkerSize’,2,‘MarkerFaceColor’,‘g’,‘MarkerEdgeColor’,‘g’,‘LineWidth’,2);
grid on
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,‘s-m’,‘MarkerSize’,2,‘MarkerFaceColor’,‘m’,‘MarkerEdgeColor’,‘m’,‘LineWidth’,2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,‘±b’,‘MarkerSize’,1.5,‘MarkerFaceColor’,‘b’,‘MarkerEdgeColor’,‘b’,‘LineWidth’,1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00]
hold on
plot(x,d,‘s-c’,‘MarkerSize’,2,‘MarkerFaceColor’,‘c’,‘MarkerEdgeColor’,‘c’,‘LineWidth’,2);
e=[0.5
0.055
0.105
0.155
0.205
0.255]
hold on
plot(x,e,‘s-r’,‘MarkerSize’,2,‘MarkerFaceColor’,‘r’,‘MarkerEdgeColor’,‘r’,‘LineWidth’,2)
xlabel(‘Number of participant’,‘fontsize’,22,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
ylabel(‘Number of measurement x10^3’,‘fontsize’,21,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’)
h=legend(‘LGHW13’,‘HSXL16’,‘CM17’,‘HSL17’,‘Ours’,‘FontSize’,12,loc = 0)
set(h,‘Fontsize’,16,‘FontWeight’,‘bold’,‘FontName’,‘Times New Roman’);
set(gca,‘FontSize’,20,‘LineWid’,2);