PaperSize In Normalized PaperUnits

Hello.
I am attempting to dynamically set the paper size based on the size of the data I have in a matrix. For example, if I had data that was 512x1024, I would want the paper size to be 1:2 relative to some unit (say an inch). In order to accomplish this generically, I want to use normalized paper units, like so:
>> set(gcf, 'PaperUnits' , 'Inches')
>> get(gcf, 'PaperSize')
ans =
8.5000 11.0000
>> set(gcf, 'PaperSize', [1, 1])
>> get(gcf, 'PaperSize')
ans =
1 1
>> set(gcf, 'PaperUnits', 'Normalized')
>> set(gcf, 'PaperSize', [0.5, 1])
>> set(gcf, 'PaperUnits', 'Inches')
>> get(gcf, 'PaperSize')
ans =
10.0000 11.2500
If I correctly understand how normalized paper units work, why in the end isn't the size set to 0.5:1 inch?
Thanks for your help.

 채택된 답변

Daniel Shub
Daniel Shub 2011년 10월 19일

0 개 추천

set(gcf, 'PaperUnits', 'Normalized')
set(gcf, 'PaperSize', [0.5, 1])
get(gcf, 'PaperSize')
The setting of the paper size is ignored. In normalized units the paper size is always [1, 1]. I don't know how MATLAB converts from normalized to inches for the paper size.
Why not just do:
set(gcf, 'PaperUnits', 'Inches')
set(gcf, 'PaperSize', [0.5, 1]*InchesPerUnit)
get(gcf, 'PaperSize')
with InchesPerUnit being the conversion from normalized paper to inches.

댓글 수: 1

Richard
Richard 2011년 10월 19일
That workaround that appears to do the trick, though I still don't understand why the paper size would get set to 10 x 11.25 after changing it in normalized units.
Thanks for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2011년 10월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by