用画家和HG2进行渲染导致打印后剧情出现黑色背景 [英] Rendering with painters and HG2 leads to black background of plot after printing

查看:111
本文介绍了用画家和HG2进行渲染导致打印后剧情出现黑色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在MATLAB中打印图形,则图形的背景将变为黑色而不是白色,如下所示:

If I print a figure in MATLAB the background of the plot gets rendered black instead of white, like this:

(但是在MATLAB的图形窗口中,它应该是白色的)
这是类似于用于打印图形的代码(但将运行复制粘贴):

(But in the figure window of MATLAB it is white as it is supposed to be)
This is the code similar to the one used to print the figure(but will run copy-paste):

figure;
set(0,'DefaultAxesFontSize',13)
set(0,'DefaultTextFontSize',13)
set(gcf, 'Renderer', 'painters');
y = 1:100;
plot(y)
xlabel('Some X', 'FontSize', 14)
ylabel('Some Y', 'FontSize', 14)
title('Example', 'FontSize', 15)
legend('some function')
print(gcf,'test1.pdf','-dpdf')

但是,如果我添加以下行,它就可以工作(当然,在绘图周围的区域中会有一些灰色背景)

If I add the following line, however, it works (but there a slight grey background in the areas around the plot, of course)

set(gcf, 'color', [0.99 0.99 0.99])

我的MATLAB版本是R2013a(8.1.0.604)

My MATLAB version is R2013a (8.1.0.604)


set(gcf, 'InvertHardCopy', 'off');无法解决问题.

edit:
set(gcf, 'InvertHardCopy', 'off'); does not resolve the issue.

edit2:
问题似乎是由HG2-Update引起的.

edit2:
The problem seams to be caused by the HG2-Update.

推荐答案

为了美观,我还使用了 HG2-Update hack.返回 HG1 对我来说是没有选择的.好吧,除了一个问题,我没有任何问题:直接打印到 .pdf .那也是您想要做的.该功能仍然完全搞砸了.

I'm also using the HG2-Update hack for the sake of beauty. Returning to HG1 is no option for me. Well, I don't have any problems with it, except one: printing directly to .pdf. That's what you're trying to do also. This functionality is still totally screwed up.

解决方案:将带有-dsvg的图保存为矢量图形,在 Inkscape 中打开文件,然后再次设置为 Export area drawing (勾画标记)的pdf文件格式.

The solution: Save with the plot with -dsvg as vector graphic, open the file in Inkscape and save again as pdf with the Export area is drawing checkmark set.

我实际上希望找到一种方法来编写此过程的脚本,但不会成功.因此,您必须手动执行此操作或等待HG2的最终版本.

I actually hoped to find a way to script this procedure, without success. So you have to do it manually or wait for the final release of HG2.

这篇关于用画家和HG2进行渲染导致打印后剧情出现黑色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆