blob: e86eda112d861a9713b776f718516d274a0e8196 [file] [log] [blame]
Adrià Vilanova Martínez42b8a892023-03-21 00:18:28 +01001library(tikzDevice)
2
3table <- read.table('dades/calibracio_ra.txt', sep="\t", dec='.', header=TRUE)
4
5# Plot the data
6plotall <- function() {
7 plot(table$ChannelNumber, table$Impulses, type="l", col="#EEEEFF", xlab="Nombre de canal", ylab="Comptes")
8 lines(table$ChannelNumber, table$ImpulsesSmooth, type="l")
9
10 # Add arrows and text labels to the peaks
11 for (j in 1:nrow(peaks)) {
12 i <- peaks[j, 'indexes']
13 label <- peaks[j, 'labels']
14 arrows(table$ChannelNumber[i], table$ImpulsesSmooth[i]+3, table$ChannelNumber[i], table$ImpulsesSmooth[i]+0.1, length = 0.05, code = 1, col = "#514E7E")
15 text(table$ChannelNumber[i], table$ImpulsesSmooth[i]+4.6, paste0("Canal ", table$ChannelNumber[i], "\n", label), col = "#514E7E", cex = 0.75)
16 }
17}
18
19indexes <- c(1601, 2359, 3373) + 1
20labels <- c("\\textsuperscript{226}Ra", "\\textsuperscript{218}Po", "\\textsuperscript{214}Po")
21peaks <- data.frame(indexes, labels)
22
23pdf('output/calibracio_ra.pdf', width = 6, height = 5)
24plotall()
25dev.off()
26
27tikz('output/calibracio_ra.tex', width = 6, height = 5)
28plotall()
29dev.off()