R displays tags from the page

I run 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 displayed on the page. I can’t figure out how to fix this. Any ideas?

Thanks.

+7
r plot
source share
1 answer

You have not left enough space in the left margin for a long mark. 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 argument 'mar' for the parameter 'par' sets the width of the fields in the order: 'bottom', 'left', 'top', 'right'. The default value is "left" to 4, here I changed it to 6.

+13
source share

All Articles