Tim - 10 months ago 50

R Question

I'm trying to create a series of histograms with the same range on the axis and crucially axis that lie at zero intercepts for both

`x`

`y`

`mydat1 <- mydat + geom_histogram(binwidth = 5) + facet_wrap(~V2, scales = "free") + theme(axis.line.x = element_line(colour = "black", size = 0.05), axis.line.y = element_line(colour = "black", size = 0.05)) + scale_x_continuous(expand = c(0,0)) + scale_y_continuous(expand = c(0,0))`

adding

`+ ylim`

`xlim`

Can someone tell me where I have gone wrong?

This is what I want to produce but I need

`y`

`x`

Answer Source

You could use

```
scale_y_continuous(limits = c(0, 15))
```

and

```
scale_x_continuous(limits = c(0, 400))
```

Does this work?