I am qiute new in the world of R, so i would like to ask, if it's possible to create a diagramm that looks like a heatmap for only one column. So now I have two varables, the depth and the chemical value and my target is to color the depths according to their chemical values, nearly like in this photo.
Hi,
have you been working with ggplot2 before? If so, then you can use the geom_tile to create something like the graphic you posted.
Here an example:
library(dplyr)
library(ggplot2)
# create a tibble with one column for depth and one for the value
depth<-seq(from=0, to=5,by=0.5)
value<-sample(1:20,11)
df<-tibble(depth,value)
# plot the heatmap
df%>%ggplot(aes(x=1,fill=value,y=depth))+
geom_tile()+
# add label inside the tiles:
geom_label(aes(label=value),fill="white")+
# flip y axis:
scale_y_reverse(breaks = depth)+
# remove x axis lable
theme( axis.text.x=element_blank())