white rectangle behind Matlab figure

Hello,
with the polar command I generate the figure fig_01......
The background of the figure rectangle is gray and that of the polarplot is white.
With the Matlab command
print('polar_plot','-depsc')
I generate an eps-figure. Whe I import this figure in a TeX-manuscript it needs more place than the polarplot alone.
So I import the Matlab-eps-file in CorelDraw and you can see a great white rectangel behind the polarplot in fig_02.....
After suspending groups it is possible to delete the white rectangle only. So I get the fig_03.....
In CorelDraw I can export this figure as an eps-file again, but now without the white rectangle.
It is possible to modify the print command to avoid the white rectangle behind the figure?

7 Comments

Does it help if you set the background color of the figure to 'none' prior to saving?
set(gcf, 'Color', 'none')
Thank you Adam, but the white rectangle is still present
I've reproduced the problem (using matlab r2019a and coreldraw version 17.1.0.572) and it happens with polar() and polarplot().
The circle on polar plots is actually a patch. The axes in polar plots are still square. To see this,
% Plot some data
theta = 0:0.01:2*pi;
rho = sin(2*theta).*cos(2*theta);
figure
polar(theta,rho,'--r')
% Grab the axes and patch handles
a = findall(gcf, 'type', 'axes');
p = findall(gcf, 'type', 'patch');
% Turn on the axes
a.Visible = 'on';
% color the patch blue
p.FaceColor = [0 0 1];
190520 185252-Figure 1.jpg
Setting the axis color to "none" didn't fix the problem when I tested it. Deleting the patch also didn't help. Specifying "-painters" as the renderer didn't help either. Then I ran out of time :(
Hello Adam and others,
the solution I get from Matlab support Friedrich
are the following commands
for any polar and cartesian plot
set(gcf,'color','none');
set(gcf,'InvertHardCopy','off');
print('-depsc','-painters','test.eps')
With aid of these commands you get the figure
at once as my fig_03_corel.......
without using CorleDraw
Siegfried
Thanks Siegfried! You should post this as an anwer and accept the answer. I didn't know about InvertHardCopy. It must be an undocumented property.
In case you're like me and are paranoid about use gcf, you can get the figure handles from the line object handle that is the first output from polar().
h = polar(theta,rho,'-r')
set(h.Parent.Parent,'color','none');
set(h.Parent.Parent,'InvertHardCopy','off');
" I didn't know about InvertHardCopy. It must be an undocumented property. "
InvertHardcopy is documented in the figure properties documentation (which is linked to from the figure documentation):
and also has its own dedicated examples page here:
(blush)
I was looking in axis properties despite the example setting a property of a figure.

Sign in to comment.

Answers (0)

Categories

Products

Release

R2019a

Asked:

on 20 May 2019

Edited:

on 22 May 2019

Community Treasure Hunt

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

Start Hunting!