如何重新调整 trackViewer Vignette lollipopPlot 的图形大小并避免 x 轴被切断

How to re-adjust figure size of trackViewer Vignette lollipopPlot and avoid x-axis cut off

我是 trackViewer Vignette lollipopPlot 的新手,我正在试验该图。但是,由于某种原因,我想重新调整图形的宽度和高度,我的图看起来很宽并且有白色 space 。我尝试更改 cex 的值,但这没有帮助。我也有 x 轴标签被切断的问题。我相信这可以通过重新调整图形大小来解决,我该怎么做?

我正在使用 RStudio 版本 1.2.5033 和 trackViewer 版本 1.24.2。

这是我的代码:

library(trackViewer)
myfile = read.csv("myfile.bed", header = FALSE, sep = "\t")
> myfile
                 V1       V2      V3 V4
1 label1 27146879 #E1C877  5
2 label2 27146883 #E7B105  1
3 label3 27146913 #2F1CDB  1
4 label4 27146957 #B169CD  1
5 label5 27147054 #6EB934  1
6 label6 27147099 #D4D592  1
> sample.gr <- GRanges("chr6", IRanges(myfile$V2, names=myfile$V1), color=myfile$V3, score=myfile$V4)
> features <- GRanges("chr6", IRanges(myfile$V2))
> sample.gr.rot <- sample.gr
> sample.gr.rot$label.parameter.rot <- 70
> lolliplot(sample.gr.rot, features, cex = 1.1, yaxis.gp = gpar(fontsize=18, lwd=2), ylab = FALSE, xaxis.gp = gpar(fontsize=11))

非常感谢您

剧情如下:

这是小插图中的修改示例:

library(trackViewer)
# in case your plot margins are too large, you can set them e.g.:
par(mar=c(0.5, 0,0,.5))
SNP <- c(10, 12, 1400, 1402)
sample.gr <- GRanges("chr1", IRanges(SNP, width=1, names=paste0("snp", SNP)))
sample.gr$color <- c("darkblue", "blue", "red", "darkred")
sample.gr$score <- c(1,2,1,5)
features <- GRanges("chr1", IRanges(c(1, 501, 1001), 
                                    width=c(120, 400, 405),
                                    names=paste0("block", 1:3)))
lolliplot(sample.gr, features, yaxis=FALSE)


# export as png with pre-set dimensions
png("testplottt1.png", width=600, height = 200)
lolliplot(sample.gr, features, yaxis=FALSE)
dev.off()

这是导出的文件: