Is there a way, how to have by geom_line/geom_smooth instead of numeric date (see hovering info in the picture Index: 18824.96) date in a format like this "2022-02-24". See the reproducible code below:
library(tseries)
library(zoo)
# install.packages('quantmod')
library(quantmod)
# Ethereum
Ethereum <- get.hist.quote(instrument = "ETH-USD",
start = "2018-01-01",
end = Sys.Date(),
quote = "Close",
compression = "d")
# Dataframe
df <- cbind(Ethereum)
df <- fortify.zoo(df)
# Ethereum
library(ggplot2)
library(plotly)
g <- ggplot(data = df, aes(x=Index, y=Close)) +
geom_line(col="cornflowerblue", lwd=0.5) +
geom_smooth(col="red", lwd=0.5, se=FALSE, linetype = "dashed") +
geom_vline(xintercept=as.numeric(as.Date("2022-02-24")), lwd=0.3, linetype=4) +
xlab("Time") +
ylab("Ethereum Price") +
scale_x_date(date_labels = "%Y-%b", date_breaks = "4 months") +
scale_y_continuous(breaks = seq(min(0), max(5000), by=500)) +
theme_bw()
ggplotly(g)