Answers for "histogram with 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

Python Answers by Framework

Browse Popular Code Answers by Language