I'm trying to create a plot with two Y-axis, each one coming from a different data frame. Is this possible?
I have created the two plots separately (temp_EXERCISEonly and DP_EXERCISEonly). Part of my script looks like this:
dftestA = dftest[dftest$orientation == 'East interior stud']
temp_EXERCISEonly <- ggplot(dftestA, aes(x=read_date)) +
#geom_point() +
geom_line(aes(y=Temperature), color='red',size = .5, alpha = 0.7) +
xlab("Time") +
ylab("Temperature (°F)") +
scale_x_datetime(
limits = c(
as.POSIXct("2016-08-01 00:00:00 "),
as.POSIXct("2019-07-31 23:00:00 ")),
breaks = date_breaks("4 months"),
labels = date_format("%m/%Y")) +
theme_bw()
temp_EXERCISEonly
#Trying to redo the plot to show condensation risks
#B Exterior Condition (Scenario of concern: summer)
#Dewpoint
dftestA = dftest[dftest$orientation == 'B Exterior Condition']
DP_EXERCISEonly <- ggplot(dftestA, aes(x=read_date)) +
#geom_point() +
geom_line(aes(y=Dewpoint), color='blue',size = .5, alpha = 0.7) +
xlab("Time") +
ylab("Dewpoint (°F)") +
scale_x_datetime(
limits = c(
as.POSIXct("2016-08-01 00:00:00 "),
as.POSIXct("2019-07-31 23:00:00 ")),
breaks = date_breaks("4 months"),
labels = date_format("%m/%Y")) +
theme_bw()
DP_EXERCISEonly
Also, this is a small sample of my data:
This is also how the column dftest$orientation looks like:
[1] "A Interior Condition" "B Exterior Condition" "East interior stud"
[4] "East exterior sheathing" "South interior stud" "South exterior sheathing"
[7] "West interior stud" "West exterior sheathing" "North interior stud"
[10] "North exterior sheathing" ```
I hope someone can help, any guidance would be much appreciated. Thank you.