Hi,
When importing an emf figure in Word 2016 the gridlines look fine but when exporting the document in pdf the transparency is wrong. Has anyone ever experienced this issure with emf files generated with MATLAB?
While in Word:
cap1.PNG
Exported in pdf through Word
cap2.PNG

댓글 수: 4

Is the image file in PNG format that is used in word? or is it in any other format?
Which version of MATLAB?
Jan
Jan 2019년 6월 14일
편집: Jan 2019년 6월 14일
@Sambit: The OP wrote "EMF file".
@MichailM: What about using EPS files for the export? This worked perfectly with Word. Although on the screen only the poor TIFF preview is displayed, the export to PDF or paper produces nice vector graphics.
MichailM
MichailM 2019년 6월 14일
편집: MichailM 2019년 6월 14일
@Sambit Senapati I export from Matlab R2019b in .emf and import in the latest wWord version (Office365). After that I export the document in .pdf.
@Jan Generally I do not prefer the eps+Word combination. When I import an .eps the image is not displayed at all.
Jan
Jan 2019년 11월 20일
@MichailM: Did you embed a TIFF preview in the created EPS file? Such a preview is a raster image, but at least it is visible in Word. When printing to paper or to a PDF the vector graphics are included.

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

 채택된 답변

Jan
Jan 2019년 6월 14일
편집: Jan 2019년 6월 16일

0 개 추천

You can replace the grid my drawing the lines manually with the wanted color. Would this solve the problem?
aAxesH = axes('NextPlot', 'add');
plot(1:10);
GridStyle.Color = [0.5, 0.5, 0.5];
GridStyle.LineStyle = '-';
GridStyle.HitTest = 'off';
Child = get(aAxes, 'Children');
XTick = get(aAxes, 'XTick');
YTick = get(aAxes, 'YTick');
XLimit = get(aAxes, 'XLim');
YLimit = get(aAxes, 'YLim');
newGrid = cat(1, ...
line([XTick; XTick], YLimit, 'Parent', aAxes, GridStyle), ...
line(XLimit, [YTick; YTick], 'Parent', aAxes, GridStyle));
set(aAxes, 'Children', [Child; newGrid]); % See: uistack % [EDITED: vChild -> 'Children']

댓글 수: 2

I tried that version of your solution
aAxes = axes('NextPlot', 'add');
plot(1:10);
GridStyle.Color = [0.5, 0.5, 0.5];
GridStyle.LineStyle = '-';
GridStyle.HitTest = 'off';
Child = get(aAxes, 'Children');
XTick = get(aAxes, 'XTick');
YTick = get(aAxes, 'YTick');
XLimit = get(aAxes, 'XLim');
YLimit = get(aAxes, 'YLim');
newGrid = cat(1, ...
line([XTick; XTick], YLimit, 'Parent', aAxes, GridStyle), ...
line(XLimit, [YTick; YTick], 'Parent', aAxes, GridStyle));
set(aAxes, Child, [Child; newGrid]); % See: uistack
and got the error below for the very last line
Error using matlab.graphics.axis.Axes/set
Invalid parameter/value pair arguments.
By removing it it was fine. A minor issue with that solution is that the figure box boundaries have the same color as the gridlines.
In your solution apart from drawing manually the gridliness you also adjust their color. In my turn I tried to adjust the color and opacity right after the "grid on" and seems to solve the problem. Here is an example:
f = 50;
T = 1/f;
w = 2*pi*f;
t = linspace(0,2*T,1000);
y = sin(w*t);
plot(t,y,'linewidth',2)
grid on
ax = gca;
ax.GridLineStyle = '-';
ax.GridColor = [0.9 0.9 0.9]; % RGB
ax.GridAlpha = 1; % Always at 1 so it keeps the exact grayscale set in the previous line
ax.XColor = 'k';
ax.YColor = 'k';
@MichailM: My suggested code contained a typo:
% Was:
set(aAxes, vChild, [Child; newGrid]); % See: uistack
% Should be:
set(aAxes, 'Children', [Child; newGrid]); % See: uistack

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

질문:

2019년 6월 1일

댓글:

Jan
2019년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by