barplot:如何获取y轴和框外的y轴标签,用box()创建?

时间:2015-12-09 11:35:09

标签: r plot latex sweave pdflatex

条形图在PDF文件中看起来很奇怪。代码:

label.text = @"text"
CGRect frame = cell.lblAddress.frame;
frame.size.height = [self getHeightforController:label];
label.frame = frame;

问题: 如何在框外得到y轴的标签(1到15)(这里是因为horiz = TRUE的x轴)?

1 个答案:

答案 0 :(得分:1)

您的pdf非常大,因为宽度和高度以英寸为单位。你的cex参数也很大。具有较小参数的代码可以很好地绘制所有内容:

pdf(fileName2.pdf",width = 12) par(mar=c(4,10,4,1),cex=2, 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"), las=1,horiz=TRUE, axes=TRUE) 
box(which="plot", lty="solid") 
dev.off()