**
**
set(gca,'looseInset',[0 0 0 0]);
**
**
plot(x1,y1,'*-','linewidth',1,'color','r')
hold on;
scatter(x2,y2,'o','filled','b');
**
axis([0 500 -3 6]);
**
**
**
grid on;
**
grid on;
set(gca,'ygrid','on','gridlinestyle','--','Gridalpha',0.5,'GridColor','g','linewidth',2)
**
**
**
xlabel('时间 /s','FontWeight','bold','Fontsize',17);
ylabel('随机数','FontWeight','bold','Fontsize',17);
**
set(gca,'Fontsize',20,'FontWeight','bold'); % 同时设置x、y轴标签和数字
set(gca,'xtick',[0,2,5,10,15,30,40]);
set(gca,'xticklabel',{'0s','2s','5s','10s','15s','30s','40s'});
set(gca, 'xticklabel', get(gca, 'xtick'), 'yticklabel', get(gca, 'ytick'));
**
ps:title语句只能在画完图之后添加有效
title('图名','position',[150 4],'Fontsize',15,'FontWeight','bold','Color','k');
**
**
**
ps:set(gca,…)也会设置图例中字体大小和粗细
legend({'legend-1','legend-1','legend-1','legend-1'});
**
**
legend({'legend-1','legend-1','legend-1','legend-1'},'Fontsize',10,'Textcolor','r');
lgd = legend('legend-1','legend-2','legend-3','legend-4');
lgd.FontSize = 20;
lgd.TextColor = 'r';
**
水平 or 垂直
lgd.Orientation = 'horizontal'; % 图例放置顺序
lgd.NumColumns = 2; % 图例放置列数
**
lgd = legend('legend-1','legend-2','legend-3','legend-4');
title(lgd,'legend title','Fontsize',15,'Color','g');
**
**
lgd = legend('legend-1','legend-2','legend-3','legend-4');
lgd.NumColumns = 2;
legend boxoff;
**
**
set(gcf,'color','r') % 图形界面颜色设置
set(gca,'color','b') % 绘图区域背景颜色