I have the following code:
library(ggplot2)
data(mtcars)
ggplot(mtcars, aes(x=mpg)) + geom_histogram(bins=15, colour='red')
Which produce this:
As stated there, how can I change the thickness of the enclosing line of the histogram?
Basically, you just need to add border=F to the hist function to remove the border of histogram bars.
To change the outlines color of histogram bars using ggplot2, we can use col argument inside geom_histogram function of ggplot2 package.
To change the number of bins in the histogram using the ggplot2 package library in the R Language, we use the bins argument of the geom_histogram() function. The bins argument of the geom_histogram() function to manually set the number of bars, cells, or bins the whole histogram will be divided into.
Just use size
argument
geom_histogram(bins=15, colour='red',size=2)
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