How to set the proper papersize?

202 ビュー (過去 30 日間)
Mr M.
Mr M. 2015 年 11 月 9 日
コメント済み: Mr M. 2015 年 11 月 9 日
I would like to use: figure('units','normalized','outerposition',[0 0 1 1]); to see my figures in the largest size on my screen. But after that I want to save it in a pdf format, but with a proper paper size, which is do not needlesly too big. For example on my screen: set(gcf,'PaperPositionMode','auto','papersize',[24 16]); is enough but too big. My question is how to calculate or get the proper number instead of [24 16] on an arbitrary screen automatically?

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 11 月 9 日
You should set the figure PaperUnits property to indicate the scale you wish to use.
It is not possible to set a single paper size that will automatically adjust to all screens that are used to read the PDF.
If you want to set it to match the size of the figure that is being used, then set the figure Units property to be the same as the PaperUnits that you will be using, then get() the figure Position property; the last two components of that will be the width and height.
oldunits = gcf('Units');
set(gcf, 'PaperUnits', 'cm', 'Units', 'cm');
figpos = get(gcf, 'Position');
set(gcf, 'PaperSize', figpos(3:4), 'Units', oldunits);
  1 件のコメント
Mr M.
Mr M. 2015 年 11 月 9 日
I want to use fullscreen figure window, but I dont want to restrict the ratio. Therefore it is possible to have a blank margin. After that I want to save the cropped figure into the pdf, and see the same textsize (in the pdf document) and everything else as shown on the screen.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by