I ploted a Levey-jennnings plot using a main data and i want to plot a seccondary y-axis using ggplot2 from date 18.08.22 to 27.09.22 of this data frame :
structure(list(DDATE = c("27.09.22", "21.09.22", "19.09.22",
"18.09.22", "15.09.22", "13.09.22", "11.09.22", "06.09.22", "04.09.22",
"01.09.22", "30.08.22", "28.08.22", "21.08.22", "18.08.22", NA
), LOT.REACTIFS = c("38279BE00", "38279BE00", "38279BE00", "38279BE00",
"38279BE00", "38279BE00", "38279BE00", "38279BE00", "38279BE00",
"38279BE00", "38279BE00", "38279BE00", "38279BE00", "38279BE00",
NA), RESULTAT = c(0.76, 0.76, 0.83, 0.64, 0.68, 0.68, 0.7, 0.65,
0.81, 0.75, 0.77, 0.74, 0.79, 0.77, NA)), row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "NA"), class = "data.frame")
On the main data frame :
structure(list(DDATE = c("17.07.22", "18.07.22", "19.07.22",
"20.07.22", "21.07.22", "24.07.22", "25.07.22", "26.07.22", "27.07.22",
"28.07.22", "31.07.22", "01.08.22", "02.08.22", "03.08.22", "04.08.22",
"04.08.22", "07.08.22", "09.08.22", "10.08.22", "14.08.22", "15.08.22",
"16.08.22", "18.08.22", "21.08.22", "28.08.22", "30.08.22", "01.09.22",
"04.09.22", "06.09.22", "11.09.22", "13.09.22", "15.09.22", "18.09.22",
"19.09.22", "21.09.22", "25.09.22", "27.09.22", "29.09.22"),
LOT.REACTIFS = c("88015LI00", "88015LI00", "88015LI00", "88015LI00",
"88015LI00", "88015LI00", "88015LI00", "88015LI00", "88015LI00",
"88015LI00", "88015LI00", "88015LI00", "88015LI00", "88015LI00",
"88015LI00", "88015LI00", "88015LI00", "88015LI00", "88015LI00",
"88015LI00", "88015LI00", "88015LI00", "38279BE00", "38279BE00",
"38279BE00", "38279BE00", "38279BE00", "38279BE00", "38279BE00",
"38279BE00", "38279BE00", "38279BE00", "38279BE00", "38279BE00",
"38279BE00", "38279BE00", "38279BE00", "03373BE00"), RESULTAT = c(0.66,
0.62, 0.71, 0.76, 0.79, 0.69, 0.7, 0.77, 0.67, 0.69, 0.74,
0.66, 0.62, 0.71, 0.69, 0.74, 0.69, 0.74, 0.66, 0.77, 0.7,
0.74, 0.61, 0.62, 0.58, 0.61, 0.6, 0.64, 0.51, 0.56, 0.53,
0.54, 0.5, 0.66, 0.6, 0.78, 0.6, 0.75)), row.names = 10:47, class = "data.frame")
thank you
I'm using the following codes :
library(ggplot2)
library(ggthemes)
# Basic scatter plot
Plot3 = ggplot(PSAT, aes(x=temp1, y=DATO2$value))+geom_line( color="grey") + geom_point(shape=21, color="black", fill="#69b3a2", size=1)+
geom_point(mapping = aes(x = temp1, y = DATO2$value, color = DATO2$LOT.REACTIFS))+
scale_y_continuous("Precipitation", sec.axis = sec_axis(~ .*17142/13553, name = "Temperature" ))
Plot3