I have a dataframe like the one below:
obj date colour measurement
A 01 red 10
A 02 green 20
A 03 red 5
B 01 green 10
B 02 red 30
B 03 red 50
I know how to present df[,c(“obj”,”date”,”colour”)] in a heatmap format:
chart <- ggplot(data=temp.df,aes(x=date,y=obj,fill=colour))
chart <- chart + geom_tile()
But I want to “squeeze” the “measurement” variable into the plot also, by opacity. That is for A-03, it will be the lightest red, and for B-03, it will be the darkest red.
Is it doable in R and ggplot2? Thanks.
alphais what you are looking for. Still working on getting a reasonable legend.