0

I'm working in ggplot with ggarrange.

I have two different datasets of different lengths of time.

I've tried using the align function to no avail. How might I align the two figures?

I've tried using the align = "hv" for ggarrange.

g1<- ggplot(ysi.data, aes(x=timedate, y=Turbid.)) +
  geom_point()

g2<- ggplot(cr300_Wai2, aes(x=timedate, y=Turb_SS)) +
  geom_point()

ggarrange(g1, g2, 
          align = "hv",
          ncol = 1, nrow = 2)
structure(list(RECORD = 88002:88007, Temp_C = c(26.12474, 26.12216, 
26.11776, 26.11399, 26.11052, 26.10859), Turb_BS = c(65.75296, 
65.49622, 64.7587, 64.38072, 66.81303, 66.01526), Turb_SS = c(13.06517, 
13.52991, 13.62757, 13.80889, 13.09224, 13.49245), Temp_C_2 = c(26.35429, 
26.34946, 26.34464, 26.34039, 26.33621, 26.33335), WD_OBS = c(0L, 
0L, 0L, 0L, 0L, 0L), Lvl_m = c(0.5693409, 0.5694, 0.569329, 0.5694232, 
0.5691475, 0.569261), timedate = structure(c(1538388300, 1538388600, 
1538388900, 1538389200, 1538389500, 1538389800), class = c("POSIXct", 
"POSIXt"), tzone = "")), row.names = c(NA, 6L), class = "data.frame")

structure(list(Date.Time = structure(c(-61575378174, -61575377274, 
-61575376374, -61575375474, -61575374574, -61575373674), class = c("POSIXct", 
"POSIXt"), tzone = ""), Temp = c(28.6, 29.21, 29.52, 32.34, 32.92, 
33.61), SpCond = c(8L, 7L, 7L, 7L, 6L, 7L), Sal = c(0, 0, 0, 
0, 0, 0), DOsat = c(36.2, 23.6, 21.8, 14.7, 10.3, 9.4), DO = c(2.8, 
1.81, 1.66, 1.07, 0.74, 0.67), Depth = c(0.303, 0.301, 0.296, 
0.297, 0.294, 0.294), Turbid. = c(1, 1.1, 1.1, 2.4, 2.2, 2.2), 
    Battery = c(10.8, 10.8, 10.7, 10.8, 10.8, 10.8)), row.names = c(NA, 
6L), class = "data.frame")

This is only a snippet. The key feature being the times are not aligned.

Graphs are not aligned, because g2 data only goes until March, while g1 goes until April.

0 Answers0