Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multi-panel plots in ggplot2: scales that are "free and equal"?

Tags:

r

ggplot2

I have issued the following command to a ggplot figure:

facet_wrap(~variable,scales="free")

but I also want for the x and y scales to be equal for each panel (while the limits vary from panel to panel). Is this possible in ggplot2?

like image 620
hatmatrix Avatar asked Nov 28 '25 23:11

hatmatrix


1 Answers

If you use facet_grid, you can specify space='free'. I think this is what you want.

require(ggplot2)

x = 1:9
group = rep(1:3, each=3)
data = data.frame(x, group)
qplot(x, x, data=data) + facet_grid(~group, scales='free', space='free')
like image 55
John Colby Avatar answered Dec 01 '25 11:12

John Colby



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!