According to the scale_continuous documentation

A numeric vector of length two giving multiplicative and additive expansion constants. These constants ensure that the data is placed some distance away from the axes. The defaults are c(0.05, 0) for continuous variables, and c(0, 0.6) for discrete variables.

Since they are stated as "expansion constants", they are not actual units.

Can we convert them to some actual units to predict the actual output?

Apr 13, 2018 2,369 views

## 1 answer to this question.

According to the document if you set limits manually, it would be more clear.

Refer below examples to know how it works:

The 1st argument gives expansion equal to multiplication by limit range.

```ggplot(mpg, aes(displ, hwy)) +
geom_point() +
scale_x_continuous(limits = c(1, 7), expand = c(0.5, 0))
# Right most position will be 7 + (7-1) * 0.5 = 10```

The 2nd argument gives the absolute expansion added to both end of the axis:

```ggplot(mpg, aes(displ, hwy)) +
geom_point() +
scale_x_continuous(limits = c(1, 7), expand = c(0.5, 2))
# Right most position will be 7 + (7-1) * 0.5  + 2 = 12```
• 8,240 points

## Arrange the order of axis elements in ggplot

How to arrange the order of axis ...READ MORE

## Use of ggplot() within another function in R

Using the ggplot2 package, I'm attempting to ...READ MORE

## Understanding output of rbind function when a list is passed as argument

While using R to practise fundamental matrices ...READ MORE

## Save a plot as image on the disk using R

Consider for both the situations: 1. Image will ...READ MORE

## Plot two variables as lines on the same graph using ggplot

If you have small number of variables, ...READ MORE

## R programming: How to compute Euler's number?

The following R statement exp(1) indicates e, and exp(2) represents e^2. This ...READ MORE

## R programming: How to pass variables from a r program to mysql function?

To include the R variables called start.date and end.date, you can use paste to ...READ MORE