Removing white space in .emf plots

조회 수: 16 (최근 30일)
million
million 2011년 1월 26일
I have a MATLAB program that generates data and plots the data. When I create the Figure, I use the following command:
figure100 = figure('Position',[1 1 1100 500],'Color',[1 1 1]);
Afterward, I use the
SAVEAS(figure100,FILENAME,'emf')
to save the figure to .emf file.
When I drag and drop the .emf file into PowerPoint I notice a large white space to the left and right of the figure. In order to remove the white space I typically CROP the figure in PowerPoint.
My question is how can I reduce the WHITE space in MATLAB so that I don't need to CROP in PowerPoint?

채택된 답변

Alex Knight
Alex Knight 2011년 1월 27일
You can simply 'ungroup' the figure when you get it into PowerPoint and delete the unwanted white box. Then you can 'regroup' the remaining objects.
Alternatively - set the background to be transparent. Then you don't care (you can definitely do this with the 'copy figure' method.
  댓글 수: 2
million
million 2011년 1월 28일
Thank you for your input. However, 'CROP' is much more easier than 'UNGROUP' & 'GROUP'.
I am no sure how to make the background transparent.
Alex Knight
Alex Knight 2011년 2월 24일
Simple!
In the figure window:
Edit>Copy Options>
Figure Background Colour>Transparent background
is one way of doing it.

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2011년 1월 26일
A lot of people have trouble saving figures nicely; it has become a FAQ . And the main answer is to use the Matlab File Exchange contribution export_fig
  댓글 수: 1
million
million 2011년 1월 28일
Thank you for your response.
I downloaded export_fig. The issue I have is with the resolution of the final product. File format .png does not look as professional as .emf.
Please find a test program I used below:
figure100 = figure('Position',[1 1 1100 500],'Color',[1 1 1]);
plot(1:10,sin(1:10));
grid;
saveas(figure100,'figure100','emf');
export_fig figure100.png -m2.5

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


Fangjun Jiang
Fangjun Jiang 2011년 1월 27일
You could adjust the position of the axes in the figure to make it looks better for you.
figure100 = figure('Position',[1 1 1100 500],'Color',[1 1 1]);
plot(1:10,sin(1:10));grid;
AxesHandle=findobj(figure100,'Type','axes');
set(AxesHandle,'Position',[0.05,0.1,0.9,0.85]);
saveas(figure100,'figure100','emf');
The position of the axes is in the format of [x,y,width,height].
You could manually adjust it to the position you like and then find out the exact number.
In the figure, click menu 'Edit'-> 'Axes Properties ...', then click the axes and adjust the position of left, right, top and bottom side
In the "Property Editor -Axes" panel, click the "More Properties ..." button, and find the "Position" value
  댓글 수: 2
million
million 2011년 1월 28일
This is a good idea. However, I am using subplot and not plot. How do you make it work for subplot?
Here is an example of my code:
clear all;
figure100 = figure('Position',[1 1 1100 500],'Color',[1 1 1]);
subplot(3,1,1);
plot(1:10,sin(1:10),'r-');
grid;
subplot(3,1,2);
plot(1:10,cos(1:10),'g-');
grid;
subplot(3,1,3);
plot(1:10,tan(1:10),'b-');
grid;
AxesHandle=findobj(figure100,'Type','axes');
set(AxesHandle,'OuterPosition',[0,0,1,1]);
saveas(figure100,'figure101','emf');
Fangjun Jiang
Fangjun Jiang 2011년 1월 31일
In your case, AxleHandle returns three handles, which are for three of your sub-plots. You could adjust each of them.

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by