3

I use matlab in order to generate plots in pdf files. These plots in pdf should have correct sized therefore I use PaperSize. Then I have to position plot with correct PaperPosition. The problem is that matlab uses some strange equation in order to calculate position of the plot on the page. So plot positioning is constant shooting with parameters instead of calculating it. For example:

set(gcf, 'PaperPosition', [-0.3 -0 7.2 3.1]); %Position the plot further to the left and down. Extend the plot to fill entire paper.[left bottom width height]
set(gcf, 'PaperSize', [6.5 3]); %Keep the paper size [width height]     

Do you know how matlab calculates this position ?

Darqer
  • 2,847
  • 9
  • 45
  • 65
  • 1
    I am not sure I understand the problem, but these related answers might help: [How to set the plot in matlab to a specific size?](http://stackoverflow.com/a/7576598/97160) or [Printing a MATLAB plot in exact dimensions on paper](http://stackoverflow.com/a/3601094/97160) – Amro May 25 '12 at 01:34

1 Answers1

2

I think by default it is in inches for paper position. You can check with this command:

get(gcf,'PageUnits')

You can also check the Units for figure showing, which by default should be pixels.

get(gcf,'Units')

Change them to the same scale, and then set position using

set(gcf,'PaperPosition',[x y width height])
set(gcf,'Position',[x y width height])

You should have the same size at least.

Fabian Schultz
  • 18,138
  • 5
  • 49
  • 56
RobertCRH
  • 21
  • 4