新浪博客

matlab画图设置图片大小以及线宽和字号命令

2013-06-06 19:59阅读:

Matlab中的坐标轴设置技巧

Matlab中的坐标轴设置技巧
axisoff; %去掉坐标轴
axistight; %
紧坐标轴
axisequal; %
等比坐标轴
axis([-0.1, 8.1, -1.1, 1.1]); %
坐标轴的显示范围
x = -pi/2:0.01:pi;
plot(x,sin(x)) %
先绘制个基本图形
% gca: gca, h=figure(...);
set(gca,
'XLim',[-pi/2pi]); %X轴的数据显示范围
set(gca,'XTick',[-pi/2:pi/4:pi]); %X
轴的记号点
set(gca,'XTickLabel',{'-pi/2' '-pi/4:' '0' 'pi/4' 'pi/2' 'pi*3/4''pi'}) % X
轴的记号
set(gca,'XGrid','on'); %X
轴的网格
set(gca,'XDir','reverse'); %
逆转X
set(gca,'XColor','red'); %X
轴的颜色
set(gac,'Xscale','log') % x轴以log 形式显示
xlim(min,max)




matlab画图设置图片大小以及线宽和字号命令

该文章讲述了matlab画图设置图片大小以及线宽和字号命令.
set(gcf,'Units','centimeters','Position',[1010 7 5]);%设置图片大小为7cm×5cm
%get hanlde to current axis
返回当前图形的当前坐标轴的句柄,
%(the first element is the relative distance of the axes to the left edge ofthe figure,...
%the second the vertical distance from the bottom, and then the width andheight;
set(gca,'Position',[.13 .17 .80 .74]);%
设置xy轴在图片中占的比例
set(get(gca,'XLabel'),'FontSize',8);%图上文字为8 point或小5
set(get(gca,'YLabel'),'FontSize',8);
set(get(gca,'TITLE'),'FontSize',8);
set(gca,'fontsize',8);
set(gca,'linewidth',0.5); %坐标线粗0.5
set(gca,'box','off');%Controls the box around the plotting area
set(get(gca,'Children'),'linewidth',1.5);%
设置图中线宽1.5

我的更多文章

下载客户端阅读体验更佳

APP专享