在使用Matlab作图的时候,要想做到科学、准确、美观必须要注意各个细节,尤其是标值、标目和坐标分化、范围,一定要力求准确。
clc
clear
xx = -1000 + (2000+1000).*rand(1,100);
yy = -500 + (2500+500).*rand(1,100);
% subplot(1,2,1);
plot(xx,yy,'.');
xlabel('x(mm)');
ylabel('y(mm)');
title('Profile');
axis([-1000 2000 -500 2500])
set(gca,'XTick',-1000:500:2000)
set(gca,'YTick',-500:500:2500)
% subplot(1,2,2);
% plot(xx,yy,'-');
% xlabel('x(mm)');
% ylabel('y(mm)');
% title('Profile');
% axis([-1000 2000 -500 2500])
% set(gca,'XTick',-1000:500:2000)
% set(gca,'YTick',-500:500:2500)
clc
clear all
close all
c = 2.997*10.^8; % m/s speed of light in vaccum
h = 6.625*10.^-34; % J.s Planck constant
k = 1.38*10.^-23; % T/K Boltzmann constant
T = 6000; % Temperature initiatlisation
lambda = (0:0.01:5)*10.^-6; % Convert the wavelength in micrometers (m, 10^-6 m)
radiation = (2*h.*(c.^2))./((lambda.^5).*(exp((h.*c)./(k.*T.*lambda))-1));
plot(lambda.*10^6,radiation,'LineWidth',1)
hold on
grid
xlabel('Wavelength (\mum)','FontName','Times New Roman')
ylabel('Spectral radiance (W\cdotsr^{-1}\cdotm^{-2}\cdotm^{-1})','FontName','Times New Roman')
title('Black Body Radiation','FontName','Times New Roman')
hold off
xlabel('JD(儒略日)');
ylabel('AOD\_Total');
title('各波段AOD随时间变化曲线');
axis([180 215 0 1.8 ])
set(gca,'YTick',0:0.2:1.8)
set(gca,'XTick',180:5:215)
set(gcf,'position',[400,400,600,300]);
h1 = legend('AOD\_1020\_Total','AOD\_870\_Total','AOD\_675\_Total','AOD\_500\_Total','AOD\_440\_Total','AOD\_380\_Total','AOD\_340\_Total')
% set(h1,'Box','off')
h2 = legend(h1(1),'1:1 Line') %选择h1图中的第一条曲线做图例
set(h2,'Box','off')
set(h2,'Fontname', 'Times New Roman') %设置图例字体
set(gca,'XTickLabel',{'530','534','538','542','546','550'})
Xtick_pos = 0:20:220;
Xtick_label =dates(Xtick_pos);
set(gca, 'XTickLabel',Xtick_label, 'XTick',Xtick_pos);
set(gca,'XTickLabelRotation',45)
高质量论文一般都要求矢量图,截图不被接受。因此,图画出来以后,执行以下命令,就可以保持长宽比率保存图片,pdf就是矢量图片。
saveas(gcf,'C:\Users\Lily\Desktop\figure_bins.pdf','pdf');
saveas(gcf,'C:\Users\Lily\Desktop\figure_bins.jpg','jpg');
axis equal
axis off
Matlab图片另存之后,在Windows下经常会变得模糊,这是dpi的问题,其实只要设置一下dpi即可解决问题。上面使用saveas函数无法控制dpi,这里使用print函数输出指定格式的图片。
注:dpi的含义
Dots Per Inch的缩写。每英寸所打印的点数或线数,用来表示打印机打印分辨率。一般来说,该值越大,表明打印机的打印精度越高。在投稿论文时候,往往要求图片要大于300dpi。
print(gcf,'-dpdf','-r300','C:\Users\Lily\Desktop\pc_p.pdf')
绘制地理栅格数据
[lon,lat] = meshgrid(-180:45:180,90:-45:-90);%制作栅格数据经纬度
R = makerefmat(-180,90,45,-45);%制作参考矩阵,(-180,90)起始点坐标,本列的左上角
% latlon2pix 函数参数中90为纬度,-180为经度
[row, col] = latlon2pix(R, 90, -180) %row = 1 col = 1
[row, col] = latlon2pix(R, 0,0) % row = 3 col = 5
[row, col] = latlon2pix(R, -90,180) %row = 5 col = 1
判断字符串中是否包含某子串
contains('2018-05-31','2018-05') %包含则返回1,不包含返回0
参考
http://blog.csdn.net/q286989429/article/details/50189313
颜色表
http://blog.csdn.net/thither_shore/article/details/52328313