保存具有不同背景颜色的MATLAB图形

Tho*_*mas 14 printing matlab save-as figure

我想打印一个深色背景和白色标签的MATLAB图形.如果我使用printsaveas命令我失去了某种颜色.绘图符号再次变暗,背景为白色.

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')
Run Code Online (Sandbox Code Playgroud)

所有三个测试文件最终都是错误的.如果我在图形菜单中选择"另存为",我可以正确保存图形.

任何想法如何解决问题?

Gha*_*aul 18

要保持背景如图所示,请使用命令集.

set(gcf,'InvertHardCopy','off');

要以其他方式调整数字,请查看此链接

http://www.mathworks.com/help/techdoc/creating_plots/f3-84337.html