- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to create a plot of empirical distribution in R?

The empirical distribution can be found by using the function ecdf and if we want to create a plot of empirical distribution then plot function will be used.

For example, if we have a vector called X then plot of empirical distribution can be created by using the below command −

plot(ecdf(X))

## Example 1

To create a plot of empirical distribution in R, use the code given below −

x<-rnorm(100) plot(ecdf(x))

## Output

If you execute the above given code, it generates the following output −

## Example 2

To create a plot of empirical distribution in R, use the code given below −

y<-rpois(10000,2) plot(ecdf(y))

## Output

If you execute the above given code, it generates the following output −

- Related Articles
- How to create a plot of binomial distribution in R?
- How to create a plot of Poisson distribution in R?
- How to create an exponential distribution plot in R?
- How to create a staircase plot in R?
- How to create ACF plot in R?
- How to create a plot in R with gridlines using plot function?
- How to create a sample or samples using probability distribution in R?
- How to create a plot in R with a different plot window size using plot function?
- How to create correlation matrix plot in R?
- How to create a dot plot using ggplot2 in R?
- How to create a perpendicular arrow in base R plot?
- How to create a cumulative sum plot in base R?
- How to create a plot using rgb colors in R?
- How to create a plot with cross sign in R?
- How to create a plot in base R without margins?

Advertisements