辅助屏幕上全屏Powerpoint中的ggplot2 png [英] ggplot2 png in fullscreen Powerpoint on secondary screen

查看:40
本文介绍了辅助屏幕上全屏Powerpoint中的ggplot2 png的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ggplot创建一个图,并将其另存为png在我的Linux框中.

I create a plot with ggplot and save it as an png in my linux box.

当我使用MS Powerpoint(2013)将绘图插入Windows中的演示文稿时,一切看起来都很好,直到使用F5进入全屏显示:在全屏显示中,轴和灰色背景网格消失了(字体渲染也明显变差了).

When I insert the plot into a presentation in Windows using MS Powerpoint (2013) it all looks fine until I go full screen with F5: in full screen the axes and the grey background grid disappears (font rendering is also noticeably worse).

在主持人笔记中看起来仍然不错.

In the presenter notes it still looks fine.

png看起来非常好,只有一次在全屏上投影到辅助屏幕(显示器/墙)时,它才变坏.在主屏幕上以全屏显示可以正常工作-这似乎不是解决分辨率的问题.

The png looks perfectly fine, only once projected in full screen on a secondary screen (monitor/wall) it goes bad. Full screen on primary screen works - this doesn't seem to be a resolution issue.

我尝试用两种不同的方式保存图并得到相同的结果:

I tried saving plots in two different ways with the same results:

# 1
ggsave(filename="test.png", p)

# 2
png(file = "test.png", width = 1024, height = 768, units = 'px', dpi=300)
print(p)
dev.off()

指定类型(cairo-png)也不起作用.

Specifieng type (cairo-png) doesn't help either.

解决方法:导出为pdf并在全屏模式下显示完全正常.如果我想随身携带笔记,这是很不方便的.

Workaround: exporting to pdf and displaying that in fullscreen works completely fine. It is only inconvenient if I want to have my notes along.

推荐答案

您可以使用新的导出包将ggplot2图形保存为本机Powerpoint格式-应该可以,请参见 https://cran.r-project.org/web/packages/export/index.html 并进行演示 https://github.com/tomwenseleers/export

You can use the new export package to save your ggplot2 graph to native Powerpoint format- that should work OK, see https://cran.r-project.org/web/packages/export/index.html and for demo https://github.com/tomwenseleers/export

典型语法非常简单,例如:

Typical syntax is very easy, e.g.:

install.packages("export")
library(export)
library(ggplot2)
qplot(Sepal.Length, Petal.Length, data = iris, color = Species, 
      size = Petal.Width, alpha = I(0.7))     
graph2ppt(file="ggplot2_plot.pptx", width=6, height=5) 

您还可以使用它导出到Word,Excel,Latex或HTML,还可以导出各种R stats对象的统计输出.

You can also use it to export to Word, Excel, Latex or HTML and you can also use it to export statistical output of various R stats objects.

这篇关于辅助屏幕上全屏Powerpoint中的ggplot2 png的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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