r - ggplot facet_grid with different y mapping -
Is it possible to use facet_grid with grid mapping data lines (or columns)?
I have dataframe:
data = data.frame (x = c (6, 10, 4, 6, 4, 4, 9, 2, 4, 4, 5, 4, 2, 7, 8, 3), z1 = c (6, 6, 9, 8, 8, 2, 3, 1, 9, 8, 3, 9, 8, 1, 10, 7 ), Z2 = c (8, 5, 6, 3, 9, 9, 8, 5, 1, 3, 5, 8, 8, 2, 3, 3), R = C ('1 L', '1 L ',' 1 L ',' 1 L ', 1 L', '1 L', '1 L', '1 L', '2 L', '2 L', '2 L', '2 L '2 L' 2 L '2 L' 2 L ')
and currently I want that wraps around two sides to each y mapping:
p1 & lt; - ggplot (data, AES (x = x, Y = z1)) + facet_wrap (~ r) + geom_point p2 (aes (color = r)) and lt; - ggplot (data, aes (x = x, y = z2)) + facet_wrap (~ r) + geom_point (aes (color = r)) arrangeGrob (p1, p2, nrow = 2)
< p> a
facet_grid
is possible to add them to call?
If you If you want all of your data in a plot, it will be better to reshape your data. Here I have used the reshape2
library to make it easier
Library (recieve 2) mm
Comments
Post a Comment