matlab print保存图像的大小,【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小的

a4c26d1e5885305701be709a3d33442f.png

?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
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值