如何通过打印功能将图形打印到剪贴板,其质量与“编辑-->复制图形”相同选项?
有没有什么方法可以将图形打印到剪贴板,以便其质量与编辑-->复制图形
选项提供的质量相同?
我曾经使用从 Matlab Central 获得的 saveppt.m 将图形保存到 powerpoint 文件。直到昨天为止效果都很好。我注意到存储的图像质量有所下降。我尝试使用完全相同的脚本和相同的源数据重新生成一些 ppt 幻灯片,但新幻灯片的质量较差。
我对这个问题进行了一些调查,发现当通过运行 print -dmeta
将图形复制到剪贴板时,剪贴板中的图像已经降级,而如果我使用 Edit- ->图形窗口中的复制图形
选项,我在图形窗口中得到的图像与原始图像一样清晰。
以下是一个示例供您参考。我通过两种不同的方法将图形中的图像复制到剪贴板,然后将其粘贴到 Microsoft Paint 程序中,并剪切一部分如下所示:
使用 print -dmeta
的图像:
使用编辑-->复制图形
的图像:
如果您比较 Xtick 标签“50”,您可能会看到来自 的图像编辑-->复制图
更流畅。
一开始我以为是分辨率的问题,但是设置-rN
来改变分辨率似乎并不能解决我的问题,至少对于N<=300来说是这样。
感谢您的帮助。
Is there any way to print the figure to the clipboard so that the quality is identical to what the Edit-->Copy Figure
option provides?
I used to save the figure to powerpoint file by using saveppt.m obtained from Matlab Central. It worked well until yesterday. I noticed that the stored image quality was somehow degraded. I tried to re-generate some ppt slides with exactly the same script and the same source data, but the new slides are simply of worse quality.
I investigated into this problem a little bit and discovered that when the figure is copied to clipboard by running print -dmeta
, the image in the clipboard is already degraded, while if I use the Edit-->Copy Figure
option in the figure window, I get the image as clear as the original image in the figure window.
Following is an example for your reference. I copied the image from a figure to the clipboard by two different methods, and paste it to Microsoft Paint program, and cut a piece of it to show below:
The image using print -dmeta
:
The image using Edit-->Copy Figure
:
If you compare the Xtick label '50', you may see that the image from Edit-->Copy Figure
is smoother.
At the beginning I thought it was a problem of the resolution, but setting -rN
to change the resolution does not seem to resolve my problem, at least not for N<=300.
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短的答案... 使用在该菜单项的回调中调用的相同函数:
较长的答案... 我到底是如何找到这个的?您可以查看 我之前对 有关重现“文件”菜单选项所做操作的相关问题。概念是一样的,只是图形菜单不同。例如,这将为当前活动的图形窗口找到所需的回调:
函数 EDITMENUFCN 是另一个稀疏记录的函数,但浏览代码(通过输入
edit editmenufcn.m
)显示它要么调用 Java(如果您使用的是 Mac),要么调用未记录的函数 UIMENUFCN。The short answer... Use the same function invoked in the callback for that menu item:
The longer answer... How exactly did I find this? You can look at my previous answer to a related question about reproducing what is done by a File menu option. The concept is the same, just for a different figure menu. For example, this will find the callback you want for the currently active figure window:
The function EDITMENUFCN is another one of those sparsely documented functions, but looking through the code (by typing
edit editmenufcn.m
) shows that it either invokes Java (if you're on a Mac) or the undocumented function UIMENUFCN.我想我自己找到了答案。使用 print -dmeta -painters 指定渲染器解决了我的问题。
在
文件-->首选项-->图形复制模板-->复制选项
中,我注意到有3个选项:我发现如果我选择1,
编辑-->复制图
输出与print -dmeta
相同的图像。所以我确认了我需要的信息位于保留信息
选项中。快速的谷歌搜索让我讨论了所应用的渲染器的潜在差异,最终我确认使用painters
会按照我想要的方式将图像打印到剪贴板。问题中的图像似乎分别由渲染器
zbuffer
和painters
生成。不过,我仍然不知道为什么paint -dmeta
的默认渲染器会发生变化。I think I found the answer myself. Using
print -dmeta -painters
to specify the renderer resolves my problem.In
File-->Preference-->Figure Copy Template-->Copy Option
I noticed there are 3 options:I found that if I select 1, the
Edit-->Copy Figure
outputs the same image asprint -dmeta
. So I kind of confirmed the information I need is in thePreserve information
option. A quick google search led me to the discussion about the potential difference of the applied renderer, and eventually I confirmed that usingpainters
will print the image to the clipboard in the way I wanted.The image in the question seems to be generated by the renderer
zbuffer
andpainters
, respectively. I still don't know why the default renderer ofpaint -dmeta
changes, though.