ggplot2:方面标签模糊 [英] ggplot2: blurry facet labels

查看:111
本文介绍了ggplot2:方面标签模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

保存ggplot图形时-无论我使用ggsave()还是例如png()-刻面标签看起来模糊.例如,下面的代码将生成刻面标签"F",其外观类似于下图,并且在文本栅格的外部像素上着色.

When I save a ggplot figure -- regardless of whether I use ggsave() or e.g. png() -- the facet labels come out looking blurry. For example, the following code produces a facet label 'F' that looks like the picture below, with coloration on the outer pixels of the text raster.

ggplot(data.frame(x=1, y=1, f='F'), aes(x, y)) +
    facet_grid(. ~ f)
ggsave('foo.png')

提前感谢您的任何建议!

Thanks in advance for any advice!

PS-根据@Brian的要求,我正在更新此帖子,以指出我使用的是Windows计算机.

PS -- As per @Brian's request, I'm updating this post to note that I'm using a Windows machine.

PPS-这次我要再次更新我的帖子,以澄清我打算将图形插入Word.因此,根据这篇文章,我想使用基于像素的格式(例如PNG),而不是基于矢量的格式(例如PDF).

PPS -- I'm updating my post again, this time to clarify that I plan to insert the figure into Word. So as per suggestion #4 from this post that @Masoud pointed me to, I would like to use a pixel-based format (e.g. PNG) rather than a vector-based format (e.g. PDF).

推荐答案

尝试禁用抗锯齿

默认(石英):

ggsave('foo.png', antialias="none"):

这篇关于ggplot2:方面标签模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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