打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

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

通常默认情况下,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小的


 

 

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


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

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

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


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

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
java接口相关例题
【例题】属性
Matlab导出高清图片的正确方法
人脸检测(一)
构建文档扫描仪
Matlab中图片保存的四种方法讲解
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服