Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - histogram rectangles line thickness

Tags:

r

histogram

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 :(

enter image description here

like image 290
CodeGuy Avatar asked Jul 12 '14 16:07

CodeGuy


People also ask

How do I change line width in R?

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.

How do I change the number of breaks in a histogram in R?

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.

What are breakpoints in histograms?

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.


1 Answers

You can set the line width with par():

opar <- par(lwd=2)
plot(h)
par(opar)

histogram plot

like image 89
Gabor Csardi Avatar answered Oct 02 '22 19:10

Gabor Csardi