1、设置坐标字体(A)
set(gca,'FontSize',12);
2、设置x轴标记文字(B)
xlabel('Frequency(Hz)','FontSize',14,'FontName','Times New Roman');
ylabel('Amplitude(dB)','FontSize',14,'FontName','Times New Roman');
3、设置绘图坐标显示范围
axis([400 3000 -20 70]); % 其中400 3000是x轴最小和最大值;-20和70是y周最小和最大值
4、设置绘图大小
set(gcf,'Position',[200 200 350 250]); % 其中(200,200)是绘图左下角坐标;
% (350,250)是绘图右上角坐标。
5、在图中标注(C)
text(1800,55,’m=0.4’,'FontSize',14); % 在400,300位置添加标注m=0.4
6、设置标题(D)
title(‘800Hz,sqrt0,1.0’);
7、设置曲线的粗细
set(findobj(get(gca,'Children'),'LineWidth',0.5),'LineWidth',1); % 设置线条粗细
8、存储绘图
saveas(gcf,’test.emf’,'emf'); % 存储当前图像为test.emf。
9、不显示绘图
set(gcf,'visible','off'); % 不显示图片
10、标注同一绘图中不同曲线
legend('m=1.0',’m=0.8’);
e.g.
一、
t1 = (0:11)/11*pi;y1 = sin(t1) .* sin(9*t1);t2 = (0:100) / 100 *pi;y2 = sin(t2) .* sin(9*t2);subplot(2,3,1)plot(t1,y1,'r.')subplot(2,3,4)plot(t2,y2,'r.')subplot(2,3,2)plot(t1,y1,'r')subplot(2,3,5)plot(t2,y2,'r')subplot(2,3,3)plot(t1,y1,t1,y1,'r.')subplot(2,3,6)plot(t1,y1,'g',t1,y1,'r.')
二、
plot(x,y,'r',x,y, 'ks','MarkerSize',7)
三、
A = load('result.txt');% for i = 0:0% start = i*4 +1% en = (i+1) *4% x = A(start:en, 1)% y = A(start:en, 2)% endfigurehold onx = A(1:4,1);y = A(1:4,2);plot(x,y, '-ks','MarkerSize',7, 'LineWidth', 1)x = A(5:8,1);y = A(5:8,2);plot(x,y, '-m+','MarkerSize',7, 'LineWidth', 1)x = A(9:12,1);y = A(9:12,2);plot(x,y, '-bo','MarkerSize',7, 'LineWidth', 1)x = A(13:16,1);y = A(13:16,2);plot(x,y, '-yx','MarkerSize',7, 'LineWidth', 1)x = A(17:20,1);y = A(17:20,2);plot(x,y, '-rd','MarkerSize',7, 'LineWidth', 1)x = A(21:24,1);y = A(21:24,2);plot(x,y, '-c*','MarkerSize',7, 'LineWidth', 1)axis([0,500,0.66,0.74])grid ontitle('Warm Prediction')xlabel('Given'),ylabel('NMAE')legend('A','B','C','D','E','F')set(findobj(get(gca,'Children'),'LineWidth',1),'LineWidth',2);