I created a secondary axis for my plot using the code below. However, once I make it interactive with the ggplotly() command, the axis disappears. Is there a way to add a secondary axis in plotly using an equation similar to my original code using the scale_y_continuous line?
WLS_FS_IDF_Plot <- ggplot() +
geom_line(data = LevelSIDF, aes(x=Recurrence.Interval, y=Water.Elevation.SFerry)) +
geom_point(data = LimEvents, aes(x=SFerryRI, y=SFerryLevel, size=0.5))+
xlab("Recurrence Interval (%)") +
ylab("Water Level (m ASL)") +
ggtitle("Water Level IDF for Ferry South") +
labs(fill = "May 18, 2023") +
theme(plot.title = element_text(hjust = 0.5)) +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"))+
theme(legend.position = "none") +
scale_y_continuous(sec.axis = sec_axis(~.-230.070, name = "Water Level at Shallowest Point (m)"))
ggplotly(WLS_FS_IDF_Plot)