# How to Plot a Beta Distribution in R (With Examples)

You can use the following syntax to plot a Beta distribution in R:

```#define range
p = seq(0, 1, length=100)

#create plot of Beta distribution with shape parameters 2 and 10
plot(p, dbeta(p, 2, 10), type='l')
```

The following examples show how to use this syntax in practice.

### Example 1: Plot One Beta Distribution

The following code shows how to plot a single Beta distribution:

```#define range
p = seq(0,1, length=100)

#create plot of Beta distribution with shape parameters 2 and 10
plot(p, dbeta(p, 2, 10), type='l')
``` You can also customize the colors and axes labels of the plot:

```#define range
p = seq(0,1, length=100)

#create custom plot of Beta distribution
plot(p, dbeta(p, 2, 10), ylab='density',
type ='l', col='purple', main='Beta Distribution')
``` ### Example 2: Plot Multiple Beta Distributions

The following code shows how to plot multiple Beta distributions with different shape parameters:

```#define range
p = seq(0,1, length=100)

#plot several Beta distributions
plot(p, dbeta(p, 2, 10), ylab='density', type ='l', col='purple')
lines(p, dbeta(p, 2, 2), col='red')
lines(p, dbeta(p, 5, 2), col='blue') 