下面是我想要在论文中包含的情节.问题是我的情节宽度很小(这使得x-axix根本不可读)
这是ggplot2代码myCode.r:
require("ggplot2")
all <- read.csv(file="benchmark/bench.query.csv", head=TRUE, sep=";")
w <- subset(all, query %in% c("sort.q1", "sort.q2", "sort.q3", "sort.q4", "sort.q5"))
w$rtime <- as.numeric(sub(",", ".", w$rtime, fixed=TRUE))
p <- ggplot(data=w, aes(x=query, y=rtime, colour=triplestore, shape=triplestore))
p <- p + scale_shape_manual(values = 0:length(unique(w$triplestore)))
p <- p + geom_point(size=4)
p <- p + geom_line(size=1,aes(group=triplestore))
p <- p + labs(x = "Requêtes", y = "Temps d'exécution (log10(ms))")
p <- p + scale_fill_continuous(guide = guide_legend(title = NULL))
p <- p + facet_grid(trace~type)
p <- p + theme_bw()
ggsave(file="bench_query_sort.pdf")
print (p)
Run Code Online (Sandbox Code Playgroud)
我环顾四周看看如何扩大情节,但我一无所获.
有关在我的代码中添加/删除/修改内容的任何想法?

use*_*622 31
在 Jupyter 笔记本中,我发现以下内容很有帮助:
# Make plots wider
options(repr.plot.width=15, repr.plot.height=8)
Run Code Online (Sandbox Code Playgroud)
Ind*_*ake 19
如果您使用 RMD(R Markdown),这将是定义宽度和高度的最简单方法。
```{r fig.align="center", echo = FALSE,fig.width = 14}
<write the code for your plot here>
```
Run Code Online (Sandbox Code Playgroud)
注意: options()对我不起作用,所以我使用了这个方法
Jaa*_*aap 14
可能最简单的方法是使用图形设备(png,jpeg,bmp,tiff).您可以按如下方式设置图像的确切宽度和高度:
png(filename="bench_query_sort.png", width=600, height=600)
ggplot(data=w, aes(x=query, y=rtime, colour=triplestore, shape=triplestore)) +
scale_shape_manual(values = 0:length(unique(w$triplestore))) +
geom_point(size=4) +
geom_line(size=1,aes(group=triplestore)) +
labs(x = "Requêtes", y = "Temps d'exécution (log10(ms))") +
scale_fill_continuous(guide = guide_legend(title = NULL)) +
facet_grid(trace~type) +
theme_bw()
dev.off()
Run Code Online (Sandbox Code Playgroud)
在width和height以像素为单位.在准备用于在互联网上发布的图像时,这尤其有用.有关详细信息,请参阅帮助页面?png.
或者,您也可以使用ggsave获得所需的精确尺寸.您可以使用以下方式设置尺寸:
ggsave(file="bench_query_sort.pdf", width=4, height=4, dpi=300)
Run Code Online (Sandbox Code Playgroud)
该width和height是英寸,dpi你可以设置图像的质量.
| 归档时间: |
|
| 查看次数: |
19261 次 |
| 最近记录: |