Reputation: 85
I would like to know if it is possible to create a ggplot with facet and different x axis?
My data looks like this
id value group
1: A 81 X1
2: B 232 X1
3: C 34 X1
4: D 52 X1
5: 0% 242 X2
6: 10% 13 X2
7: 20% 291 X2
8: 30% 45 X2
so my current code looks like this
myplot <- ggplot(mydata, aes(id, group = group)) +
geom_bar(aes(y = value, fill = id), stat="sum") +
facet_grid(~group)
myplot
Which creates 2 plots with all id values for each plot and adds for group X1 value 0 for 0%,10%...
I would like to have two plot with different x axis which i could achieve with just doing two filtered plots but is it possible with facet?
Upvotes: 1
Views: 2259