I try to create heatmap in R using ggplot where I want the X-axis to be the date and Y-axis to be the return. I exported a stock data using quantmod and I calculated the daily returns. This is my code:
library(quantmod)
library(zoo)
library(ggplot2)
library(dplyr)
test1=getSymbols("BTC-USD",auto.assign=F)
test2=dailyReturn(test1)
test2=test2%>%fortify.zoo()%>%mutate(dr=daily.returns*100)
fig1=ggplot(data=test2,aes(x=Index,y=dr,fill=dr))+geom_tile()
When I run the code above, it returned an empty plot like this
Now, what I'm expecting is a plot like this.
Where the X-axis is the date and the Y-axis is the returns. The Y-axis should be from -1.5 to 1.5. Is there any way to make heatmap with only 2 values (the date and the returns)?