1
votes

I am trying to save the figure with a black background. But Matlab was only able to print it in white. I notice a similar question here:

Save MATLAB figure with different background color

But this does not solve my issue. My code is like this:

scatter3(randn(1000,1),randn(1000,1),randn(1000,1))
set(gca,'color','k')
set(gcf,'color','k')
set(gcf, 'InvertHardCopy', 'off');

I got my axis region black but the background is still white. Can you guys help me out?

I am using Matlab 2013a, if this matters. Thanks in advance!

1
how are you saving the figure? - Dan
Thanks for pointing that out! I use saveas and now it works! Used to save by hand but failed... Why so different? - HJC
You're probably just not ticking the right box somewhere when saving by hand - Dan
Which box? I just click the save button and choose the format (eps) to save it. Anything else I need to do? - HJC
There are many many settings in the export dialogue box which I think controls what happens when you choose save like you are describing. But anyway, it's easier to do it in code and it works so I wouldn't worry about it - Dan

1 Answers

0
votes

Thanks Dan for helping me on this problem. I write this basically because someone might not read the comments...

You can use saveas command to get your figures. That will solve the background issue.