I want to print a MATLAB figure with a dark background and white labels. If I use the print
or saveas
command I lose somehow the colors. The plot symbols are dark again and the background is white.
points = rand(100,3);
plot3(points(:,1),points(:,2),points(:,3),'*w')
grid on
set(gca,'Color',[0.5 0.5 0.5])
saveas(gcf,'test1','pdf')
saveas(gcf,'test2','png')
print(gcf,'test3.pdf','-dpdf')
All three test files end up being wrong. If I choose "Save As" in the figure menu I am able to save the figure correctly.
Any ideas how to resolve the issue?
Approach 1: a) From the File menu, select "Export setup". b) Under Properties select Rendering and check the “Custom color” option. c) Enter “w” in the adjacent text box and click “Apply to Figure” to update the figure.
Save Figure to File Save the figure to a file by first clicking Export, and then specifying a file name, location, and desired format. For more information about file formats, see saveas .
Color Name or Short Name — Specify the name of a color such as "red" or "green" . Short names specify a letter from a color name, such as "r" or "g" . RGB Triplet — Create a custom color by specifying a three-element row vector whose elements are the intensities of the red, green, and blue components of a color.
To keep the background as in your figure, use the command set.
set(gcf, 'InvertHardCopy', 'off');
For adjusting the figure in other ways, check out this link
http://www.mathworks.com/help/techdoc/creating_plots/f3-84337.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With