I'm trying to plot a graph of a linear profile with integrated pictures of drilling cores at certain points and hights in the profile. I have a directory with 22 .png images of the drilling cores, each has a length of 1 m, and a .csv file with the x and z (z_korrig in .csv file) positions of the top center of each image. Since I'm a novice when it comes to R, I'm stuck at the point where I assign the coordinates to the raster images and actually integrate them into the plot.
Here is my code so far with the output scatter plot:
#import coordinates
coord <- read.csv("Bohrungen Höhe.csv", sep = ";", header = TRUE)
#plot to check csv
plot(coord$x, coord$z_korrig,
xlab = "length in m",
ylab = "heigth in m",
main = "profile 1")
The raster images should be positioned with their top center at the points in the scatter plot (images have the names B01.png..., corresponding to the ID with the coordinates in the .csv file), showing the actual profile. I also feel like it would be beneficial for visualisation to double the width of the images.
This is the content of my .csv file:
ID x z z_korrig
1 B01 100 4.77 3.32
2 B02 110 4.83 3.38
3 B03 120 4.96 3.51
4 B04 130 5.28 3.83
5 B05 80 4.69 3.24
6 B06 140 5.69 4.24
7 B07 150 6.03 4.58
8 B08 160 6.25 4.80
9 B09 170 6.38 4.93
10 B10 180 6.48 5.03
11 B11 190 6.64 5.19
12 B12 200 6.82 5.37
13 B13 210 6.97 5.52
14 B14 70 4.81 3.36
15 B15 60 4.94 3.49
16 B16 50 5.05 3.60
17 B17 40 5.19 3.74
18 B18 30 5.33 3.88
19 B19 20 5.46 4.01
20 B20 10 5.82 4.37
21 B21 0 5.65 4.20
22 B22 90 4.72 3.27
rasterImage
function can put a PNG onto a base graphics plot.