How can I get the actual lines (that form the many rectangles) on a histogram to be thicker? I would like to avoid using ggplot
.
Here is some code that generates a histogram so that we have a reproducible example:
h = hist(rnorm(100),plot=F)
plot(h,lwd=4) #note, lwd does not work :(
To set plot line width/thickness in R, call plot() function and along with the data to be plot, pass required thickness/line-width value for the “lwd” parameter.
To change the number of bins in the histogram in Base R Language, we use the breaks argument of the hist() function. The breaks argument of the hist function to increase or decrease the width of our bars by fixing the number of bars, cells, or bins the whole histogram will be divided into.
It shows the breaks, which are the cutoff points for the bins. It shows the counts, intensity/density for each bin (same thing but two different names for R version compatibility), the midpoints of each bin, and then the name of the variable, whether the bins are equidistant, and the class of the object.
You can set the line width with par()
:
opar <- par(lwd=2)
plot(h)
par(opar)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With