尽管可以在插图或页面布局软件中随意调整发送到PDF的R图的比例,但科学期刊通常坚持所提供的图具有特定的尺寸。
所有绘图元素的大小可以在给定的PDF大小内直接在R中缩放吗?
require(ggplot2)
p <- qplot(data=iris,
x=Petal.Width,
y=Petal.Length,
colour=Species)
pdf("./test_plot_default.pdf")
print(p)
graphics.off()生成足够比例的图元素

但是,更改PDF大小元素不会导致绘图元素缩放。对于较小的PDF,绘图元素与绘图空间相比过度放大。
pdf("./test_plot_dimentionsions required by journal.pdf", width=3, height=3)
print(p)
graphics.off()

使用@Rosen Matev建议:
update_geom_default("point", list(size=1))
theme_set(theme_grey(base_size=6))
pdf("./test_plot_dimentionsions required by journal.pdf", width=3, height=3)
print(p)
graphics.off()

发布于 2014-02-01 00:50:44
奇怪的是,您可以在ggsave(...)中使用scale=做到这一点
require(ggplot2)
p <- qplot(data=iris, x=Petal.Width, y=Petal.Length, colour=Species)
ggsave("test.1.pdf",p)
ggsave("test.2.pdf",p, width=3, height=3, units="in", scale=3)尝试使用scale参数,看看会得到什么……
发布于 2014-02-01 04:21:38
期刊坚持有特定的绘图尺寸,以避免缩放。如果这样做,可能会使字体太小(或太大),并且与图形标题的字体大小不一致。这就是为什么绘图元素(文本、点大小等)根据设计,无论pdf大小如何,都具有相同的绝对大小。
您可以更改默认字体大小和磅值,例如,使用:
p <- ggplot(iris, aes(x=Petal.Width, y=Petal.Length, colour=Species)) +
geom_point(size=1.5) + # default is 2
theme_grey(base_size=10) # default is 12
ggsave("test.1.pdf", p)默认值也可以全局更改:
update_geom_defaults("point", list(size=1.5))
theme_set(theme_grey(base_size=10))发布于 2014-02-05 09:54:21
与pdf同样好或更好的选项是tiff。我读过的所有日记都像是口水仗。
tiff(filename="name.tiff", width=5, height=5, units="in",
pointsize=8, compression="lzw", bg="white", res=600,
restoreConsole=TRUE)
qplot(data=iris, x=Petal.Width, y=Petal.Length, colour=Species)
dev.off()如果你在linux上,去掉restoreConsole=TRUE,似乎只有windows喜欢这样。
https://stackoverflow.com/questions/21484999
复制相似问题