Search code examples
matlabmatlab-figure

Matlab figure print with no axes box


I'm trying to print a figure with the mapping toolbox. When I print my figure, it always shows a black axes box, although it is not visible in the Matlab figure itself.

This code reproduces the problem:

f = figure;
f.Position = [f.Position(1:2) 765 421];
ax = axesm('MapProjection','robinson',...
    'MapLatLimit',[-90 90],'MapLonLimit',[-180 180],....
    'Frame','on','Grid','on');
ax.XColor = 'w';
ax.YColor = 'w';
tightmap

print('test','-dpng','-r150')

This is my test.png file with the black axes box: test.png file

This is a screenshot from my Matlab figure: screenshot

EDIT: adding a box off removed the top and right line EDIT2: adding a ax.Visible = false; worked


Solution

  • I figured it out.

    Adding an ax.Visible = false; did it