加载中…
个人资料
vera吧噗
vera吧噗
  • 博客等级:
  • 博客积分:0
  • 博客访问:5,524
  • 关注人气:81
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

【matlab】 print输出图像大小调整

(2012-08-23 13:14:21)
标签:

杂谈

分类: MATLAB
http://hi.baidu.com/new/curbzz

?通常默认情况下,print命令输出图像为 8*5inches,无视屏幕显示尺寸
通过命令行修改的话有三步

1 设置paperposition为manual
??set(gcf,'PaperPositionMode', 'manual')
?[ auto | {manual} ]

 

2 设置paperunit  
?set(gcf,'PaperUnits')
[ {inches} | centimeters | normalized | points ]

 

3 设置paperposition
set(gcf,'PaperPosition',[left,bottom,width,height])

 

例如
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperUnits', 'points');
set(gcf, 'PaperPosition', [0 0 640 480]);

 

还有一个相关命令是papersize
paperposition 是placement,代表图像在paper中的所处位置。left和bottom计算好,就可以使图像在paper中居中
papersize是纸张大小;position要比size小的

http://hiphotos.baidu.com/vera__wei/pic/item/58d985d9ee5eaa17d1164e4e.jpgprint输出图像大小调整" TITLE="【matlab】 print输出图像大小调整" />

 

 

?PaperPosition
    four-element rect vector
    Location on printed page. A rectangle that determines the location of the figure on the printed page. Specify this rectangle with a vector of the form
     rect = [left, bottom, width, height]
    where left specifies the distance from the left side of the paper to the left side of the rectangle and bottom specifies the distance from the bottom of the page to the bottom of the rectangle. Together these distances define the lower-left corner of the rectangle. width and height define the dimensions of the rectangle. The PaperUnits property specifies the units used to define this rectangle.?


要使图像比例输出与屏幕显示的一致,可以使用如下命令
屏幕显示图像尺寸可以plot时用 set(gcf,'position',[left bottom width height]) 调整,或者print之前拖动窗口手动调整

?This example exports a figure at screen size to a 24-bit TIFF file, myfigure.tif.
set(gcf, 'PaperPositionMode', 'auto')   % Use screen size
print -dtiff myfigure

==================================================================================================================================================================================================================================================================


单位("units")属性的默认值为像素(pixels),但是它的属性值还可以为英尺(inches),公分(centimeters),点(points),或归一化坐标(normalixed coordinates)。像素代表了屏幕像素,即在屏幕上可表示出来的最小的对象。典型的计算机屏幕最小分辨为 640×480,在屏幕的每一个位置都有超过 1000 的像素。因为像素数因机算机屏幕的不同而不同,所以指定对象的大小也会随之改变。 
归一化坐标是在 0 到1范围内。在归一化坐标中,屏幕的左下角为[0,0]右上角为[1.0, 1.0]。  如果对象的位置归一化坐标系的形式描述,那么不同分辨率的显示器上对象的相对位置是固定的。例如,下面的语句创建了一个图象,把图象放置在屏幕的上部,而不用考虑显示器的大小。 
H = figure(1) 
set(H,'units', 'normalized','position',[0 .5 .5 .45]) 
 
好的编程习惯:如果你想把对象放置在窗口的特定位置,最好的方法是用归一化坐标,因为不用考虑显示器的大小。 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有