赞
踩
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]);
分别设置X轴和Y轴显示范围
xlim([-100 100]);
ylim([-100 100]);
set(gca,'xticklabel',{'0s','2s','5s','10s','15s','30s','40s'});
set(gca, 'xticklabel', get(gca, 'xtick'), 'yticklabel', get(gca, 'ytick'));
设置figure的名字
figure('Name','Gyr x');
**
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');
ps:设置参数较多时可用关键字赋值,效果一样
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') % 绘图区域背景颜色
X = categorical({'10.4','10.5','10.7','10.9','10.13','10.18','10.20','10.23','10.24','10.25','10.26','10.28','10.30'});
X = reordercats(X,{'10.4','10.5','10.7','10.9','10.13','10.18','10.20','10.23','10.24','10.25','10.26','10.28','10.30'});
Y = a(10:22,2)';
bar(X,Y);
xlabel('时间');
ylabel('个数');
setting_figure();
参考链接:
[1] 超全Matlab绘图方法整理
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。