Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the histogram borderline thickness in ggplot geom_histogram()

Tags:

r

ggplot2

I have the following code:

library(ggplot2)
data(mtcars)
ggplot(mtcars, aes(x=mpg)) + geom_histogram(bins=15, colour='red')

Which produce this:

enter image description here

As stated there, how can I change the thickness of the enclosing line of the histogram?

like image 373
neversaint Avatar asked Mar 15 '17 01:03

neversaint


People also ask

How do you change the border on a histogram in R?

Basically, you just need to add border=F to the hist function to remove the border of histogram bars.

How do you change the border color on a histogram in R?

To change the outlines color of histogram bars using ggplot2, we can use col argument inside geom_histogram function of ggplot2 package.

How do I change the bin size in Ggplot?

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.


1 Answers

Just use size argument

geom_histogram(bins=15, colour='red',size=2)
like image 92
Feng Avatar answered Oct 06 '22 04:10

Feng