保存具有不同背景颜色的MATLAB图形 [英] Save MATLAB figure with different background color
问题描述
我要打印带有深色背景和白色标签的MATLAB图形.如果使用print
或saveas
命令,我会以某种方式失去颜色.情节符号再次变黑,背景为白色.
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?
推荐答案
要保持背景如图所示,请使用命令集.
To keep the background as in your figure, use the command set.
set(gcf,'InvertHardCopy','off');
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
这篇关于保存具有不同背景颜色的MATLAB图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!