2017-07-30 80 views
1

我想繪製一個圖像,然後覆蓋頂部的傳說。圖例覆蓋了情節,我無法使用不同的參數調整它,如cex, lty, etc傳奇重疊在Rstudio的情節

plot(cov16_2ms04h$unqC_Sp, cov16_2ms04h$unqC_My, log="xy", 
col=(cov16_2ms04h$binom_q<0.001)+1, 
ylab="Haplotype B Count", xlab="Haplotype A Count") 
abline(0,1,col="grey") 
legend("topleft",c("No significant imbalance","Significant imbalance"),pch=c(10,10),col=c(1,2), cex = 0.5) 

是給我的情節一樣:

Observed plot

不過,我想是這樣的:

Expected plot

感謝,

+0

請讓你的代碼塊[MCV(https://stackoverflow.com/help/mcve ) –

回答

1

有你在覆蓋傳說之前試圖放大劇情的大小?我試過你的傳說代碼,這個傳說在劇情上是完美的。

1

問題出在R-studio上,因爲輸出圖的大小是由窗格大小決定的。

要將結果直接繪製到pdf或png文件中,可以進行以下操作。

# plotting directly on pdf or png - select the required one 
pdf("my_plot.pdf", height=6, width=6) 
png("my_plot.png", width = 4, height = 4, 
    units = 'in', res = 300) 

plot(cov16_2ms04h$unqC_Sp, cov16_2ms04h$unqC_My, log="xy", 
    col=(cov16_2ms04h$binom_q<0.001)+1, 
    ylab="Haplotype B Count", xlab="Haplotype A Count") 

abline(0,1,col="grey") # draw abline 

legend("topleft",c("No significant imbalance","Significant imbalance"), 
    pch=c(1,1),col=c(1,2), cex = 0.75) # add legend 

dev.off() # close the plot 

輸出則當屬:

enter image description here

感謝,