Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

ggplot2 histogram

# Add mean line
p+ geom_vline(aes(xintercept=mean(weight)),
            color="blue", linetype="dashed", size=1)
# Histogram with density plot
ggplot(df, aes(x=weight)) + 
 geom_histogram(aes(y=..density..), colour="black", fill="white")+
 geom_density(alpha=.2, fill="#FF6666") 
Comment

PREVIOUS NEXT
Code Example
Python :: sklearn rmsle 
Python :: df.drop index 
Python :: how to speak the text with python 
Python :: sort two lists by one python 
Python :: pip install speedtest 
Python :: autoclicker in python 
Python :: pandas left join 
Python :: f string round 
Python :: delete image with python 
Python :: python clone object 
Python :: python run 2 functions at the same time 
Python :: install flake8 python 
Python :: matplotlib remove ticks and lines 
Python :: python print colored text 
Python :: intersection of two lists python 
Python :: membercount discord.py 
Python :: how to migrate from sqlite to postgresql django 
Python :: update anaconda 
Python :: order by listview django 
Python :: How do I mock an uploaded file in django? 
Python :: sort_values 
Python :: python pip version check 
Python :: django runserver 
Python :: changing dtype of multiple columns to_datetime 
Python :: how to loop the length of an array pytoh 
Python :: django refresh form db 
Python :: get python version in code 
Python :: how to make a discord bot dm someone python 
Python :: create new django project 
Python :: python time execution 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =