i'm running the following:
png(filename="figure.png", width=900, bg="white")
barplot(c(1.1, 0.8, 0.7), horiz=TRUE, border="blue", axes=FALSE, col="darkblue")
axis(2, at=1:3, lab=c("eleph开发者_StackOverflowant", "hippo", "snorkel"), las=1, cex.axis=1.3)
dev.off()
and the labels on the left are appearing off the page. I can't seem to figure out how to fix it. Any ideas?
Thanks.
You haven't left enough space in the left margin for labels that long. Try:
png(filename="figure.png", width=900, bg="white")
par(mar=c(5,6,4,1)+.1)
barplot(c(1.1, 0.8, 0.7), horiz=TRUE, border="blue", axes=FALSE, col="darkblue")
axis(2, at=1:3, lab=c("elephant", "hippo", "snorkel"), las=1, cex.axis=1.3)
dev.off()
The 'mar' argument of 'par' sets the width of the margins in the order: 'bottom', 'left', 'top', 'right'. The default is to set 'left' to 4, here I have changed it to 6.
精彩评论