R ggplot2 - 使用 RGui 绘图时没有背景或网格线

发布于 2024-08-19 04:35:38 字数 1252 浏览 3 评论 0原文

我在 RGui 中的输出窗口(在 Win XP 下)遇到了一个奇怪的问题。我应该看到如下图所示的情节...

替代文本

...当我运行此脚本时:

library(ggplot2)
x <- rnorm(100,0,1)
y <- rnorm(100,0,1)
z <- data.frame(x,y) 
g <- ggplot(z, aes(x,y)) + geom_point() + theme_gray()

相反,在绘图窗口中它显示白色背景和白色网格线,如下所示。

R 绘图窗口

替代文字

当我将绘图导出为 .png 并在 Windows 资源管理器中“预览”它时,它不显示背景或网格线。

Windows 中的 Png

alt text

Gimp 中的相同 Png

alt text

相同的 Png 上传到图片托管

alt text

对正在发生的事情有什么想法吗?如何让绘图在 RGUI 中正确显示?

I'm having a strange problem with the output window in RGui (under Win XP). I should see a plot like the one below...

alt text

... when I run this script:

library(ggplot2)
x <- rnorm(100,0,1)
y <- rnorm(100,0,1)
z <- data.frame(x,y) 
g <- ggplot(z, aes(x,y)) + geom_point() + theme_gray()

Instead, in the plot window it shows a white background and white grid lines, like below.

R Plot Window

alt text

When I export the plot to .png and I "preview" it in windows explorer - it doesn't show a background or grid lines.

Png in Windows

alt text

Same Png in Gimp

alt text

Same Png uploaded to image hosting

alt text

Any ideas about what's going on? How can I get the plot to display correctly in RGui?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这样的小城市 2024-08-26 04:35:38

听起来像是设备问题而不是 R 问题,请尝试重新安装 GTK+。如果这不起作用,请尝试绘制 jpeg 而不是 png(如果可以的话)。

Sounds like a problem with the device rather than R, try reinstalling GTK+. If that doesn't work try plotting jpegs instead of png's if you can.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文