Answers for "plot histogram in r ggplot"

2

ggplot2 histogram

library(ggplot2)
# Basic histogram
ggplot(df, aes(x=weight)) + geom_histogram()
# Change the width of bins
ggplot(df, aes(x=weight)) + 
  geom_histogram(binwidth=1)
# Change colors
p<-ggplot(df, aes(x=weight)) + 
  geom_histogram(color="black", fill="white")
p
Posted by: Guest on March-25-2020
0

geom_histogram r

ggplot(diamonds, aes(x = price)) + geom_histogram(binwidth = 1000)
Posted by: Guest on March-19-2021

Browse Popular Code Answers by Language