1
條形圖在PDF文件中看起來很奇怪。代碼:barplot:如何獲取y軸以外的y軸標籤和使用box()創建的框?
pdf("fileName2.pdf", width=100, height=75)
par(resetPar())
par(mar=c(30, 150, 7, 7), lwd=2)
barplot(as.numeric(c(2, 4, 1, 6)), col = c("lightblue"), main="Bar plot",
names.arg=c("This is \nbar 2...1","This is bar 2...2",
"This is bar 2...3","This is bar 2...4"), , xpd=TRUE, las=1, lwd=3,
horiz=TRUE, axes=TRUE, axis.lty=1, space=1, cex.axis=22, cex.names=22)
box(which="plot", lty="solid")#lty = '1373'
dev.off()
問題: 如何獲得標籤(1〜15)y軸(這裏是X軸,因爲HORIZ = TRUE)外箱?
你可以在第二次(而不是在barplot調用),那麼你可以把它們放在你喜歡的地方 – Cath
你的PDF是真的大,寬度和高度將它們添加以英寸指定。你的cex參數也很大。你的代碼用較小的參數繪製一切正常:'pdf(fileName2.pdf「,width = 12) par(mar = c(4,10,4,1),cex = 2,lwd = 2) barplot(as。數字(c(2,4,1,6)),col = c(「lightblue」),main =「條形圖」, names.arg = c(「This is \ nbar 2 ... 1」,「這是條2 ... 2「, 」這是條2 ... 3「,」這是條2 ... 4「),las = 1,horiz = TRUE,軸= TRUE) box = 「暗算」,LTY = 「實」)」 dev.off()' – Jimbou
@CathG:??你怎麼能以這種方式後barplot – b4154