carlo
carlo

Reputation: 260

plot without border (like hist) in r

If you call function hist on r, you will note that the box that usually surrounds plotting region doesn't appear, instead, only rulers indicating plot scale appear on the bottom and on the left. If you use r a lot you may probably have noticed this already. my question is: there is some graphical parameter or workaround to make this happen on any other plot of basic r (like in a scatterplot, a line plot, a qq plot or whatever)?

The only parameter I found was axes, but setting it to FALSE makes it disappear not only the box, but also the rulers.

Upvotes: 0

Views: 287

Answers (2)

carlo
carlo

Reputation: 260

the answer is bty graphical parameter:

 x= matrix(rnorm(100), ncol= 2)
 plot(x, bty= 'n')

Upvotes: 1

jay.sf
jay.sf

Reputation: 73692

You are looking for box().

op <- par(mfrow=c(1, 2))

hist(mtcars$mpg, sub="w/o box")

hist(mtcars$mpg, sub="w/ box")
box()  ##  <-- this

par(op)

enter image description here

Upvotes: 2

Related Questions