Hi.
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("elephant", "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.
From stackoverflow
-
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.
K P : This worked, thanks. It's surprisingly difficult to google for stuff like this.wkmor1 : True. R being called 'R' has never made things easy for googleing and the like.Marek : My most linked tread: http://stackoverflow.com/questions/102056/how-to-search-for-r-materials
0 comments:
Post a Comment