white rectangle behind Matlab figure
Show older comments
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
Adam Danz
on 20 May 2019
Does it help if you set the background color of the figure to 'none' prior to saving?
set(gcf, 'Color', 'none')
Siegfried Martius
on 20 May 2019
Adam Danz
on 20 May 2019
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];

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 :(
Siegfried Martius
on 21 May 2019
Edited: Siegfried Martius
on 22 May 2019
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');
Stephen23
on 21 May 2019
" 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:
Adam Danz
on 21 May 2019
(blush)
I was looking in axis properties despite the example setting a property of a figure.
Answers (0)
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!