How to remove whitespace around subplot figures?

조회 수: 38 (최근 30일)
Joren Heit
Joren Heit 2011년 6월 29일
편집: Pankaj 2018년 10월 8일
I'm writing a report in LaTeX in which I need to include some MATLAB figures. One of them is a subplot consisting of 16 plots which I ordered (manually, using subplot('Position',...)) in a 6x3 matrix (leaving 2 blancs ofcourse). However, when I export the figure as a png file, there's loads of whitespace on both sides of my figure. I have fumbled around with the PaperPosition parameter but this didn't help me at all. Does anyone know how to crop the 'paper' tightly around my figure?
PS. the method explained on http://nibot-lab.livejournal.com/73290.html doesn't seem to work on a subplot figure as a whole...

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 6월 29일
this post might help you.

추가 답변 (2개)

Jan
Jan 2011년 6월 29일
편집: Jan 2017년 8월 20일
I'd expect that PDF or EPS are a better format for embedding graphics in a LaTeX report.
Instead of cropping the PNG, you can increase the space for the subplots:
FigH = figure('DefaultAxesPosition', [0.1, 0.1, 0.8, 0.8]);
[EDITED] The property is called 'DefaultAxesPosition', not 'DefaultAxesPosition*s*'.
  댓글 수: 2
Nicholas Richmond
Nicholas Richmond 2017년 8월 18일
In R2017a,
FigH = figure('DefaultAxesPositions', [0.1, 0.1, 0.8, 0.8]);
yields
Error using figure
There is no Positions property on the Axes class.
Jan
Jan 2017년 8월 20일
@Nicholas: This was a typo. See [EDITED].

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


Pankaj
Pankaj 2018년 10월 8일
편집: Pankaj 2018년 10월 8일
The reason is, it requires 'ActivePositionProperty' property of axes set to 'outerposition'. By default, subplots have an ActivePositionProperty set to 'position'.

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by