vendredi 27 février 2015

facet_wrap equal axis per panel


Vote count:

0




I would like to make a plot using facet_wrap where the axes can vary for each panel but within a panel the x and y axes should be the same scale.


e.g. see the following plots



df <- read.table(text = "
x y g
1 5 a
2 6 a
3 7 a
4 8 a
5 9 b
6 10 b
7 11 b
8 12 b", header = TRUE)

library(ggplot2)

ggplot(df, aes(x=x,y=y,g=g)) +
geom_point() +
facet_wrap(~ g)

ggplot(df, aes(x=x,y=y,g=g)) +
geom_point() +
facet_wrap(~ g, scales = "free")


What i want is for panel a the x and why axes both to be 1-8 and for panel b the x and y axes both to range from 5 - 12.


Is this possible?



asked 1 min ago







facet_wrap equal axis per panel

Aucun commentaire:

Enregistrer un commentaire