图形尺寸限制 [英] Limit of figure dimensions

查看:111
本文介绍了图形尺寸限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在回答以下问题和与该问题无关的问题时,通过创建高度很高的图形,我发现图形被裁剪了.如果将人物的子代的'units'属性设置为'normalized',则相应的子代将缩小而不是裁剪.

During the answering this question and issues, unrelated to the question, with creating figures with really high height I've found that figures are cropped. If 'units' properties of figure's children is set to 'normalized' the appropriate child is shrunk rather than cropped.

问题是,为什么图形的高度受到限制,并且限制了什么(属性)规则.看起来我的身高限制为9.94英寸(Dell Latitude E5500; Win7企业版,32位; matlab 2011b;分辨率1400x900 px)

The question is, why is the height of figure limited and what (property) rules that limit. It looks like I'm limitted to figure height of 9.94" (Dell Latitude E5500; Win7 enterpise, 32-bit; matlab 2011b; resolution 1400x900 px)

修改

我尝试过:

>> set(gcf,'position',[10 10 600 600]),get(gcf,'position')

ans =

 10.0000   10.0000   28.3333    9.8750

>> set(gcf,'position',[0 0 600 600]),get(gcf,'position')

ans =

 0     0   600   600

在Adobe acrobat 9 Pro中,通过export_fig获得的图形在两种情况下均为28.35"x 9.88".

The figure obtained by export_fig is in both cases 28.35" x 9.88" as measured in Adobe acrobat 9 Pro.

推荐答案

我怀疑这与Matlab检测到的最大显示尺寸以及系统的像素密度有关.

I suspect it has to do with with the maximum display size detected by Matlab and the pixel density of your system.

在我的Matlab R2013a,Windows 7和1900x1200的屏幕上,我可以得到比你大的身材,但它仍然会被截断:

On my Matlab R2013a, Windows 7, with a screen 1900x1200, I can get a bigger figure than you, but it will still be truncated:

%% // MATLAB R2013A - Windows 7, 1900x1200pixels
set(gcf,'units','inches','position',[1 -5 6 15])
get(gcf,'position')
get(gcf,'OuterPosition')

返回:

ans =
          1.00         -5.00          6.00         11.81
ans =
          0.92         -5.08          6.17         12.71

我最大的垂直图形尺寸被切成11.81英寸.现在,这是Matlab图形的内部.包含标题栏和边框的实际大小由属性OuterPosition给出.

My maximum vertical figure size was cut at 11.81 inches. Now that is the inside of a Matlab figure. The real size including the title bar and borders is given by the property OuterPosition.

现在考虑:

>> get(0,'ScreenSize')
ans =
          1.00          1.00       1920.00       1200.00
>> get(0,'ScreenPixelsPerInch')
ans =
         96.00

如果我们执行1200pixel/96ppi = 12.5.在这种屏幕密度下,Matlab只能显示价值12.5英寸的图形.如果将单位设置为像素",这将是显而易见的模式:

If we do 1200pixel/96ppi=12.5. With this screen density, Matlab can only display 12.5 inches worth of graphics. This will be even mode obvious if you set the unit to 'Pixels':

set(gcf,'units','inches','position',[1 -5 6 15])
set(gcf,'units','Pixels')
get(gcf,'position')
get(gcf,'OuterPosition')
ans =
         97.00       -479.00        576.00       1134.00
ans =
         89.00       -487.00        592.00       1220.00

该图正好在1220像素处被截断(英寸单位只是一个转换,Matlab基本单位将以像素为单位).我怀疑标题允许额外增加20个像素.

The figure was truncated at exactly 1220pixels (the inches unit is just a conversion, Matlab base unit will work in pixels). I suspect the extra 20 pixels allowed are an extra allowance for the title bar.

现在有了您的数字,我没有图形的outerposition,但是即使图形内部位置也确实与您的屏幕尺寸大致匹配(900px * 96ppi = 9.375英寸).尝试将单位恢复为Pixels,获得图形的OuterPosition,如果您获得920像素,我也不会感到惊讶.

Now with your numbers, I do not have the outerposition of your figure, but even the figure inner position does match roughly your screen dimension (900px*96ppi=9.375inches). Try to force the units back to Pixels, get the OuterPosition of the figure and I wouldn't be surprised if you get 920pixels.

现在看来,您只需要为旧版本的Matlab担心.在装有Matlab R2015b的同一台计算机上(Win 7,1900x1200px),不再进行自动裁剪:

Now it seems you only need to worry about that for older versions of Matlab. On the same machine (Win 7, 1900x1200px), with Matlab R2015b, no more automatic cropping:

%% // MATLAB R2015B - Windows 7, 1900x1200pixels
set(gcf,'units','inches','position',[1 -5 6 15])
get(gcf,'position')
get(gcf,'OuterPosition')
ans =
          1.00         -5.00          6.00         15.00
ans =
          0.92         -5.08          6.17         15.40
set(gcf,'units','Pixels')
get(gcf,'position')
get(gcf,'OuterPosition')
ans =
         97.00       -479.00        576.00       1440.00
ans =
         89.00       -487.00        592.00       1478.00

Matlab的新图形引擎似乎已经解除了这一限制,现在我的身材大于我的屏幕尺寸(无论是像素还是英寸).

The new graphic engine of Matlab seem to have lifted that restriction, my figure is now bigger that my screen size (whether you look at pixels or inches).

这篇关于图形尺寸限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆