【发布时间】:2022-10-01 14:19:08
【问题描述】:
我正在尝试以 pdf 格式保存两个 ggplots。当我在 r 绘图显示器中可视化它们时,一切都很好。保存 png 或其他图像格式时,保存的图像正是我在 r 显示器中可视化的图像。但是,当尝试另存为 pdf 时,结果却大不相同。
我用了: dev.print(pdf,\'Viral_load_methods.pdf\')
对于其中一个图,误差条变得非常细,如下所示。
原版 enter image description here
pdf版本 enter image description here
对于另一个图,箱线图的线条变得很粗。
原始显示 enter image description here
pdf显示 enter image description here
如何获得以 pdf 格式保存的、忠实于 r 显示的绘图?
-
试试
ggplot2::ggsave(),它通常更适合ggplot2对象